Developed at AT&T bell laboratories in 1972 by Dennis Ritchie.
#include<stdio.h> //preprocessor command which tell compiler to include stdio.h file
int main(){ //c program starts from main function
printf("Hello world!");
return 0; //will return 0 for os
}
auto,break,case,char,const,Continue,default,do,Double,extern,Float,for,goto,If,Inline,Int,long,register,short,Signed,sizeof,static,Struct,switch,typedef,union,unsigned
*float value=4e10 //4 power10
*sizeof(value)// it will print bytes occupied by value
*null character // ’\0’
Typedef: rename a datatype, syntax: typedef int rajesh; rajesh a=10;//rajesh become int
&&(and),||(or),!(not)
is for bytes&(and),|(or),^(xor),~(1s compliment), <<(left),>>(rigth)
collection of similar datatype
int a[5]; int a[]={1,2,3,4,5};
a) one dimensional, b) two dimensional, c) three dimensional
array of character
char name[] = "rajesh";
char name[5] = {"r","a","j","e","s","h"}
variable contains address of another variable
int *a; a=&b; a=0;//null pointer or default
*a=55; printf("%d",&b);//55
printf("%d",*a);
address type will be whole number(2 byte)
pointer’s subraction allowed but other math operation not allowed in c
set of instruction that are used to perform specified tasks
int getName(int arg){
return 3;
}
storing different datatype in one variable
struct student{
int rollno;
char name[];
}
struct student rajesh = {1,"rajesh"};
same like strucutre but memory allocation difference and takes half of struct size
union student{
int rollno;
char name[];
}
union student rajesh = {1,"rajesh"};
FILE *fpointer;
Fpointer=fopen(“rajesh.txt”,”w”); //r-read, w-write, a-edit
#include<stdio.h>
- prinf,scanf,getchar,putchar#include<stdlib.h>
- number rconversion, memory alloc, exit and system, quick sort#include<float.h>
- system liit for flot type#include<math.h>
- mathematical function#include<assert.h>
- assertions#include<ctype.h>
- character class tests#include<limits.h>
- system limit for integral types#include<setjmp.h>
- non local jumps#include<signal.h>
- signal and error handling#include<stdarg.h>
- variable length parameter list#include<string.h>
- string function#include<time.h>
- date and time functions#include<conio.h>
- clrscr(), getch(), getche() etcchar description; description=malloc(100sizeof(char)); //now we can use description variable as
realloc(descrciption, 100*sizeof(char));