can i get a little help on correctting the loop over scanfCode:#include <stdio.h> #include <stdio.h> #include <stdlib.h> #define MAX 20 typedef struct { int ID; char* firstname; char lastname[MAX]; float unit; double gradeAvg; }INFO; int main (void) { // Global declarations INFO myInfo; int i = 0; // Statements myInfo.firstname = (char*)calloc(20,sizeof(char)); printf("Enter your first and last name:\n"); for(i = 0; i < MAX; i++) { scanf("%s %c", myInfo.firstname, &myInfo.lastname[i]); } printf("Enter your ID number:\n"); scanf("%d", &myInfo.ID); printf("Enter your total unit completed:\n"); scanf("%f",&myInfo.unit); printf("Enter your grade point average:\n"); scanf("%lf", &myInfo.gradeAvg); i = 0; for(i = 0; i < MAX; i++) { printf("%9s %c\n", *myInfo.firstname, myInfo. lastname[i]); } printf("%6d\n", myInfo.ID); printf("%.1f\n",myInfo.unit); printf("%lf\n", myInfo.gradeAvg); return 0; }
thank you