I use xCode because I found the debugger very useful. Therefore, in the debugger that I see, after entering the student name [0] = \ 0, it does not matter. But then the rest of the name will be correct. For example, if I put John, he will return, saying \ 0, o, h, n. Help me please?
char name[MAX_NAME_LENGTH]; char department[MAX_DEPT_LENGTH]; int rank; int empty = 0; printf("\nPlease enter the students name: "); scanf("%s", &name); printf("\nPlease enter the students department: "); scanf("%s", &department); printf("\nPlease enter the students rank: "); scanf("%d", &rank); strcpy(studentArray[empty].name, name); strcpy(studentArray[empty].department, department); studentArray[empty].rank = rank;
source share