#include<stdio.h> struct node { char c[5]; }; void main() { struct node n[]={"ABC","TECH"}; printf("%c",n[1].c[1]); } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

#include<stdio.h> struct node { char c[5]; }; void main() { struct node n[]={"ABC","TECH"}; printf("%c",n[1].c[1]); }

Gove me output and explain it please

29th Apr 2020, 9:52 AM
Rihaj Mujawar
Rihaj Mujawar - avatar
1 Answer
0
You declared a structure called 'node' that can store an array of 5 characters. In the main function you create an array of structs of type node, and you initialize the first element with the string "ABC" and the 2nd element with the string "TECH". You then print the 2nd character of the string stored in the 2nd element of the array 'n'. struct node n[0] = "ABC" struct node n[1] = "TECH" | c[1] So the output is: E
29th Apr 2020, 10:20 AM
Damyian G
Damyian G - avatar