I've written a program for collecting data of students, it compiles and runs but I've called my show_person function and it is not showing it when I run it?
My show_person function is supposed to print out the name, age and gpa of studentCode:3 #include<stdio.h> 4 struct Person 5 { 6 char name[100]; 7 int age; 8 float gpa; 9 10 }; 11 void fill_person(struct Person* per) 12 { 13 printf("Enter name of student:"); 14 fgets(per->name,100, stdin); 15 printf("Enter age of student:"); 16 scanf("%d", &per->age); 17 printf("Enter GPA of student:"); 18 scanf("%f", &per->gpa); 19 20 } 21 void show_person(struct Person* per) 22 { 23 printf("name: %c/n", &per->name); 24 printf("age: %d/n", &per->age); 25 printf("GPA: %f/n", &per->gpa); 26 } 27 28 29 30 int main() 31 { 32 33 struct Person per; 34 fill_person(&per); 35 show_person(&per); 36 return 0; 37 }



LinkBack URL
About LinkBacks


