Sie sind auf Seite 1von 6

let us see the c programming: =============================> computer program-a sequence of instruction to be performed by a computer.

program characteristics: ========================> simplicity clarity integrity efficiency modularity features of c: ==============> >>c is a powerful,flexiblelanguage that has gained ww acceptance in these years. >>it is becoming the standard for program development on small machines and microcomputers. birth of c: ============> >> dennis m ritchie developed c in early 70s at bell labs. >> and the c program is used in the Turbo C environment. headerfile used in c language: ==============================> #include<stdio.h> stdio.h-standarinputoutput.headerfile printf(); scanf(); #include<conio.h> conio.h-console.inputoutput.headerfile clrscr(); #include<math.h> math.h-mathamatics.headerfile sqrt-squreroot PI-pie #include<string.h> used to print a string syntax of c programming: ========================> preprocessor directives main() a pair of flower brackets{ } declaration and statements user created sub_programs or functions components are organized as follows: ====================================> preprocesser directives main() { declaration and statements }

user created sub_programs or functions easily understandable form: ===========================> headerfiles function; main() { data_type variables; statements1; statements2; . . statementsn; } { function } data types used in c language: ==============================> data type-a specific set of data values,along with a set of operations on those values. name -- used in program -- range -- size9o

integer -- int -- (-32768 to 32767)-- 2 bytes or 16 bits character -- char --(0 to 255) -- 1 bytes or 8 bits float -- float -- (3.4e-38 to 3.4e38) -- 4 bytes or 32 bits double -- double -- (1.7e-308 to 1.7e308) -- 8 bytes or 64 bit space declaration of variable used in c language: ===========================================> syntax: data_type m1,m2,m3,.........,mn; a simple program to print: =========================> #include<stdio.h> #include<conio.h> main() { printf("Hello Anu"); getch(); } coditions: ==========> if if else if else if nested if if ---if(condition) statement; printf();

if else ------if(condition) { statement1; } else { statement2; } if else if ----------if(condition) { statement1; } else if(condition) { statement2; } nested if ---------if() { statement1; } esle { statements2; } if { statements3; } looping: ========> for while do while for ----for(initialization;condition;increment/decreament) { statement1; statement2; } while -----initialization; while(condition) { statements; increment/decrement;

} do while ----------do { initialization; { statement; increment/decrement; } }while(condition) operators: =========> operators:> operators are tools for manipulating the data. operators in c can be categorised into 7 different types.they are: 1.arithmetic operators 2.assignment operators 3.relational operators 4.logical operators 5.conditional operators 6.bitwise operators 7.special operators 1.arithmetic operators: =======================> arithmetic operators are divided into two .binary arithmetic operators + addition sum= a+b; 5=3+2; - subtraction sub=a-b; 5=10-5; * multiplication mul=a*b; 14=2*7; / division div=a/b; 5=10/2; % modulo division mod=a%b; 2=17%5; .unary arithmetic operators - unary minus value=-6; ++ increment num=i++;post increment

num=++i;pre increment -- decrement num=i--;post num=--i;pre 2.assignment operator: ======================> assignment operator is used to assign to identifiers(these are the names given t o various programming elements) syntax: variable=value\expression; ex: num=10; compound assignment operators are divided into arithmetic assignment operators += sum+=i; sum=sum+i; -= sum-=i; sum=sum-i; *= sum*=i; /= sum/=i; %= sum%=i; bitwise assignment operators &= = ^= >>= <<= 3. relation operators: ======================> == equal to != not equal to < less than <= less than or equal to > greater than

>= greater than or equal to 4.logical operators: ====================> AND-&& ORNOT-! ---------------------logical AND operand1--operand2--&& f--f--f f--t--f t--f--f t--t--t ((a>b)&&(b>c)) ---------------------logical OR operand1--operand2-f--f--f f--t--t t--f--t t--t--t ((a==b) (c==d)) ---------------------logical NOT operand--result f--t t--f n!=45; ------------------------

Das könnte Ihnen auch gefallen