Hey guys, I'm just trying to get to grasp with structs and I have written a small test program to print out a persons name and age. Currently I am getting nothing when the program runs. Help :(
#include <stdio.h>
struct person
{
char *name;
int age;
};
struct person people[5];
int main( void )
{
people[0].name = "Bob";
people[0].age = 45;
people[1].name = "Steve";
people[1].age = 32;
int i;
for(i = 0; i < 5; i++)
{
char *value = people[i].name;
int value2 = people[i].age;
printf("%s %d\n", value, value2);
}
return(0);