1. When an automatic structure (also applies for an array) is partially initialized remaining elements are initialized to 0(zero).
2. Since x < y turns to be TRUE it is replaced by 1. Then 1 < z is compared and to be TRUE. The 1 is assigned to i.
-------------------------------------------------
i = x < y < z;
-------------------------------------------------
printf("%d\n", i);
3.printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i); It prints the value ofu.ch[0] = 3, u.ch[1] = 2 and it prints the value of u.i means the value of entire union size.
So the output is 3, 2, 515.
During the for loop execution scanf() ask input and then printf() prints that given input. This process will be continued repeatedly because, scanf() returns the number of input given, the condition is always true(user gives a input means it reurns '1').
Hence this for loop would get executed infinite times.
Is it true that a global variable may have several declarations, but only one definition?
int bit1:1; --> 'int' indicates that it is a SIGNED integer.
Because ++ or -- cannot be done on enum value.
C doesn't do array bounds checking at compile time, hence this compiles.
printf("%e, ", f); Here '%e' specifies the "Scientific Notation" format. So, it prints the 43.20 as 4.320000e+01.
printf("%f, ", f); Here '%f' specifies the "Decimal Floating Point" format. So, it prints the 43.20 as 43.200001.
printf("%g, ", f); Here '%g' "Use the shorter of %e or %f". So, it prints the 43.20 as 43.2.
s is a character pointer
s[0]=black and ptr[0]=violet
s[1]=white ptr[1]=pink
s[2]=pink ptr[2]=white
s[3]=violet ptr[3]=black
here p=ptr means p,ptr represents same address
++p means ++ptr = pink
++p+1 means ink
No comments