Monday, 31 December 2018

Keywords and Identifiers of C Language

Identifiers
Identifiers are names that are given to various program elements, such as variables, functions and arrays. These are user-defined. Identifiers consist of letters, digits and some characters but the first letter must be a letter. Generally lowercase letter is used but uppercase letter can also be used. Uppercase and lowercase letters are not interchangeable.
Identifiers can be of any length but typically it accepts 31 characters.
The following names are valid identifiers.

    a   x   xy   firstname  lastName  area_of_circle   _length  test18
The followings are not valid identifiers.
         18test                   The first character must be a letter
         "xx"                      Illegal character "
         first name             Blank space
         last-name              Illegal character -

Keywords:
In C programming language, there are some certain reserve words. These reserve words are called Keyword. Keywords can be used only in particular purpose that is defined in language. So, keywords cannot be used as identifiers. Keywords have standard predefined meanings.
C keyword list is below:
      
Keywords in C Language
auto double int struct
break else long switch
case enum register typedef
char extern return union
continue for signed void
do if static while
default goto sizeof volatile
const float short unsigned

Note that the keywords are all lowercase. Since uppercase and lowercase characters are not equivalent, it is possible to utilize an uppercase keyword as an identifier. Normally, however, this is not done, as it is considered a poor programming practice.

Sunday, 30 December 2018

C Character Set


Character set is important for any computer languages because this character is understood by the compiler. To write a program, we code, but the code has to be meaningful to the compiler. To write statement, expression, variable or custom function name, this are formed from this computer set.

C character sets are belows:
  • Uppercase letter A to Z
  • Lowercase letter a to z
  • The digit 0 to 9
  • And some special character sets
    +    -      *    /    =    %   &    # 
    !     ?     ^    "      '   ~      \      |
    <     >   (      )      {    }     [      ]
    :      ;     .     ,       _
Most versions of the language also allow certain other characters, such as @ and $, to be included within strings and comments. It also allow some White space characters. These are;
  • \b blank space
  • \t horizontal tab
  • \v vertical tab
  • \r carriage return
  • \f form feed
  • \n new line 
  • \\ Back slash
  • \’ Single quote
  • \" Double quote
  • \? Question mark
  • \0 Null
  • \a Alarm (Audible Note)

Saturday, 29 December 2018

C Program Structure

C program structure

C is structured. So, it is modular and the modules are function, i.e. the modules are called function. One of the functions must be called main. The program will always begin by executing the main function, which may access other functions.

To run a c program, you must include something at the beginning of the code, which will ensure your smooth compiling. It is sort of mandatory because this loads some initial code to run a program. For example;
#include <stdio.h>

The #include is a "preprocessor" directive that loads a file called stdio.h (stdio.h is a header file). Header files are collection of some build-in codes that does a lot of task to run a program.
Now look at the below program;

#include <stdio.h>
int main()
{
  printf("Hello,World"); 
  return 0; 
  //end of code(this is a comment)
}

So the whole program is enclosed by a function and this function is called 'main()'.
In later tutorial, you will learn about details of functions, how to write function, how to use it, what are required to write a function.  
Codes are written in an enclosed pair of braces, i.e., { }
Inside braces expression statements are written, i.e., printf("Hello,World");
Each expression statement must end with a semicolon (;). 
Comments (remarks) may appear anywhere within a program, as long as they are placed within the delimiters  /* and */ (e.g., /* this is for multiple comment */). Single line comment can be written after two forward slashes //.
The program is typed in lowercase. Either upper- or lowercase can be used, though it is customary to type ordinary instructions in lowercase.

Wednesday, 26 December 2018

History of C Language

History of C

C was developed by Dennis Ritchie at Bell Telephone Laboratories, Inc. (now a part of AT&T) in 1972. When Dennis Ritchie was trying to rewrite the code for UNIX operating system, C was born. He was considering to rewrite the system using the B language, Thompson's( Ken Thompson invented B programming language) simplified version of BCPL. The name of C was chosen simply as the next after B. So, C is an outgrowth of two earlier languages, called BCPL and B.

Earlier days, C was basically used within Bell Laboratories. In 1978, Brian Kernighan and Ritchie published a definitive description of the language. The Kernighan and Ritchie description is commonly referred to as "K&R C." After that, further development of C was began. By the mid 1980s, the popularity of C had become widespread. Numerous C compilers and interpreters had been written for computers of all sizes, and many commercial application programs had been developed. Many commercial software applications were started to re-written in C language.

Due to availability of various C compilers, minor incompatibilities were found between different implementations of the language. To stop this problem, the American National Standards Institute (ANSI) formed a committee, X3J11, to establish a standard specification of C in 1983. In 1990, the ANSI C standard (with formatting changes) was adopted by the International Organization for Standardization (ISO). Later the different versions of C was introduced as C89, C99 etc. and the current standard for the C programming language is C18(published in June, 2018).




Tuesday, 25 December 2018

Introduction to C Language

Introductoin to C language

C is a general-purpose, structured programming language. It is really a powerful language to write complex computer program and that's why it is really one of a popular high level language like Pascal and Fortran. It has features that allows user to write low-level programming language and it is flexible also to write system programming (i.e. operating system) and application programming. 

It's instruction set includes large number of operators, several built-in functions, control-statement keyword etc. Hence, it allows users to write additional library function. Program written in C language is very fast.

C is highly portable. So, a C program, written in one computer can be run on another with little or no modification. The reason for this is that C relegates most computer-dependent features to its library functions. 

As it said earlier that C is structured programming language which means program can be written as block in terms of function module. A proper collection of modules would make a complete program.

Monday, 21 December 2015

IMEI Number


IMEI stands for 'International Mobile Equipment Identity', is a unique (15 or 17 digit) number assigned to  mobile phone. It can also be found in 3G/4G tablets, laptops with PCMCIA wireless internet cards, and other mobile equipment. In a dual-SIM phone, you’ll see two IMEI numbers, one for each SIM slot. The IEMI is also known as 'International Mobile Station Equipment Identity'. In the case of CDMA network there is also a MEID number.

The main purpose of using this number is to trace the device. As the number is unique, it helps us to identify the device and therefore it can be used for stopping a phone from accessing that network if it is theft. We can use this number to block a mobile phone from being used by another person.

How to find this number: 
  • Dial *#06# on your keypad and press call or send button, your IMEI number will be retrieved and displayed on your screen.
  • On the back or bottom of the device or under, IMEI number can be found printed.
  • IMEI numbers can also be printed on the original packaging of your device.

The Structure of an IMEI Number:
IMEI numbers either come in a 17 digit or 15 digit sequences of numbers. The IMEI format currently utilized is AA-BBBB-CC-XXXXXX-Z:


First 8 digits of IMEI number are TAC (Type Allocation Code) which will give you the mobile phone brand and model. Other 7 digits are defined by manufacturer (6 are serial number and 1 is check digit).
For example a IMEI number: 354230061155201 
Here TAC: 354230 | FAC: 06 | SNR: 115520 | CD: 1

What Is The Difference Beween Numerals and Number?

Number is a concept, it is a mathematical concept. To express the quantitative value of the object, this  is developed in ancient history. S...