Introduction to Programming in C Language
C is general purpose programming language. It is the outcome of to programming languages B and BCPL. All three programming languages were developed at BELL laboratory,USA.It lies between high and lower languages so it is also called middle level language. The C chharacter set consists of ALPHABETS,Digits and Special symbols.There are 91 characters in C . The C tokens are the Basic units of C programs and they are categorised into Keywords ,identifiers ,constants,strings,operators and special symbols. All the keywords in c have 1 or more fixed meanings and cannot be changed the keywords must be written in lower case letters .
The identifiers cannot be changed. The Identifiers are the names given to the program elements such as variables Arrays and Functions.All the variables must be declaried for their types before they are used in the program. The constant is the quality that does not change exaction of a program . Each instruction and with character semicolon "," and comments can be placed anywhere . All the words ina program line must be separted from each other by atleast one space or tab or punctation .
Every c Program requires a main () function and it plays is where the program execution of a fuction begans at the opening brace of the function and ends at corresponding closing brace we must make sure to include header files using # include directive when the program refers to special names and functions that it does not define.
Compiler Directive
Compiler directives such as define and include are special instructions to the compiler to help it to compile the program.They do not end with semi colon .The sign # hastag of compiler directives must appear in the first column of the line . When the braces are used to group statements ,make sure that the opening brace had a corresponding closing Brace. To read the data from the Input device input statements are used and to print the processed data onto the output device output statements are used .These input /output (I/O) statemnts can be formated or unformated in unformated I statements know specifications of data types and the mannner in which they are read in or written out is mentioned but, formated (I/O) statements specify what type is being input or dispalyed and in what way it should be .
Scanf() and Printf() are the 2 in-built functions used to read and print the data . they are used for all types of data like int,char,float,double ,etc .In General, it is not possible to read multi-word string with with scanf() function . Using escape squences , we can format the output as per requirements .
Data Types
Data type is a set of values among with of set of permisable operation. Simple data types consists of integers (short,int,long) , real number(float ,double ) and characters (char). Every data item to be used in program needs to be declared /intilised . The backslash (\). Charcter constants perform a specific task .They began with a backslash(\) .Both the backslash and an associated character are enclosed within single quotes .
There are four data types like signed ,unsigned ,short, long. These are used to provide the accueracy and precision to the integer and character data type .
NOTE : %* C specification is used to read the new line (\n),which is obtained by pressing the neter key and enter key is used to enter the character to reach at the new line .
0 Comments