pass structure to function
ok im messing around with structures again
and i cant seem to pass the structure to the function
Code:
#include <stdio.h>
#include <stdlib.h>
struct record_format {
char name[BUFSIZ];
int age;
};
void display(struct record_format);
int main(int argc, char *argv[])
{
struct record_format record[] = {
{ "john", 21 },
{ "larry", 22 }
};
display (record);
getchar();
}
/************************************************************************/
void display(struct record_format rec)
{
int i;
for(i=0;i<2;++i)
printf("name is %s \nage is %d \n", rec.name, rec.age);
}
Quote:
24 C:\Dev-Cpp\mainffff.c incompatible type for argument 1 of `display'
when i add the name and age to the structure is when it wont pass anymore!