It is a operator can keyword in ‘c’ language
{ int i; char ch; float f; printf("\n size of int %d”, sizeof(i)); printf(“\n size of char: %d ”, sizeof ch); printf(“\n size of float : %d”, size of F); } o/p: size of int : 2 size of char:1 size of float:4 sizeof(int) 2 bytes sizeof(signed) 2 bytes sizeof(short) 2 sizeof(long) 4 sizeof(25) 2 sizeof(40000u) 2 sizeof(655361) 4 sizeof(char) 1 sizeof(‘A’) 2 // sizeof(65) --- >2 char ch; ch=’A’; sizeof(ch) 1 size of character or character variable is 1 byte but the size of character constant is 2 bytes, because by default character constant returns integer value. i.e ‘ASCII’ value of a character. So, we will get 2 bytes sizeof(ch) 1 sizeof(float) 4 sizeof(double) 8 sizeof(long double) - 10 sizeof(short double) error sizeof(12.8) 8 //double sizeof(12.8f) 4 //float sizeof(12.8L) 10 // long double sizeof(3.0) 8 sizeof(3.5) 8
{ int i; i=0; printf(“\nsize1:%d”, size(i)); printf(“\nsize2:%d”, size(i*1 5l)); printf(“\nsize3:%d”, size(i/2.0)); printf(“\nsize4:%d”, size(i/2.0f)); printf(“\nsize5:%d”, size(i=i*15)); printf(“\ni=%d”,i); o/p : size1 : 2 //int Size2 : 4 // int,long long size3 : 8 //int,double double size4 : 4 //int, float float size 5 : 2 //int,int int i=0 in size of operator all expressions can be evaluated except assignment.
{ int a; a=10; printf(“\n size of a: %d”, sizeof(++a)); //a=a+1 ignore inclure printf(“/n a=%d”,a); } o/p : size of a:2 a=10
You liked the article?
Like: 2
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.