Hey, i want to ask something: in the red points do we need " & "? and why?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
struct school{
int age;
int name[30];
};
void fuc_age(struct school A, int z){
int i, n;
/* Initializing age */
for(i=0; i<n; i++){
printf("Type your age:\n");
scanf("%d", &A[i].age);
}
}
void fuc_name(struct school A, int z){
int i, n;
for(i=0; i<n; i++){
printf("Type your name:\n");
scanf("%s", &A[i].name);
}
}
int main(void){
int i, n;
struct school *A;
printf("Please type n:\n");
scanf("%d", &n);
A = (struct school *)malloc(n*sizeof(struct school));
/* Print the A... */
for(i=0; i<n; i++){
printf("Name: %s, Age: %d\n", A[i].name, A[i].age);
}
//system("pause");
return 0;
}