Please show how the output of the following C program is Jan
Please show how the output of the following C program is Jan 31:
#include <stdio.h> int main (void)
 {
 struct book
{
 int no;
 char name[3];
 } b1;
 b1 ={ 31, {\'J\', \'a\', \'n\'}};
printf (\"--------------------\ \");
 printf (\"%c%c%c %i\ \",b1.name[0], b1.name[1], b1.name[2], b1.no); return 0;
 }
Solution
Answer: Jan 31
Hi,
This code will print the output like Jan 31.
We decalred the structure book with two variables one i no int tye and name char array type.
This statement b1 ={ 31, {\'J\', \'a\', \'n\'}};will store 31 value to \"no\" int variable and {\'J\', \'a\', \'n\'} value wil store in name char array. so while printing the values by this line
printf (\"%c%c%c %i\ \",b1.name[0], b1.name[1], b1.name[2], b1.no);
it will print Jan 31
![Please show how the output of the following C program is Jan 31: #include <stdio.h> int main (void) { struct book { int no; char name[3]; } b1; b1 ={ 31,  Please show how the output of the following C program is Jan 31: #include <stdio.h> int main (void) { struct book { int no; char name[3]; } b1; b1 ={ 31,](/WebImages/30/please-show-how-the-output-of-the-following-c-program-is-jan-1082809-1761568909-0.webp)
