I don't know why printf don't wiew name and adresse. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I don't know why printf don't wiew name and adresse.

To display adresse and name https://code.sololearn.com/cg7WhQ49ifwk/?ref=app

13th Mar 2020, 7:06 AM
Malick Diagne
Malick Diagne - avatar
2 Answers
0
Try to use const char* name const char* address
13th Mar 2020, 7:11 AM
Danil SwD
Danil SwD - avatar
0
Use `struct` instead of `union` for the student information. #include <stdio.h> struct student // use struct, not union { int id; char nom[50], adresse[50]; }; int main() { struct student data = {64, "Malick", "NYC"}; // use struct, not union printf("ID: %d\n", data.id); printf("Name: %s\n", data.nom); printf("Address: %s\n", data.adresse); return 0; }
13th Mar 2020, 7:14 AM
Ipang