Comma and Sizeof() operator

                                       Comma and Sizeof() operator 
  
Comma Operator:-

Comma operator( , ) is to separate declaration of two variables ,two data types.It is also helpful in scanning and printing,In built in functions.I can explain you with this below example:-  
int a ,b ,c ,d;
//<datatype><var.>,<var>; 
 
float e;
//<datatype><var.>,<var>;
 
printf("%d",a);
scanf("%d",a);
 


Sizeof() :-
 this operator is used get size of variable.I can explain you with this below example:-  
 
int a,i;
i=size of (int a) ; //out will be 2 because integer use 2 bytes in memory

int =sizeof(datatype/variablr no.)

 
OperatorDescriptionExample
sizeof()Returns the size of an variable.sizeof(char  a), where a is interger, will return 1.
sizeof()Returns the size of an variable.sizeof(int  a), where a is interger, will return 2.
sizeof()Returns the size of an variable.sizeof(float a), where a is interger, will return 4.
sizeof()Returns the size of an variable.sizeof(double a), where a is interger, will return 8.

Comments

Popular posts from this blog