Why am I not getting the right display in C?
[code]
<#include<stdio.h>
#include<conio.h>
struct boat
{ int age;
char name[30];
}passengerinfo[2];
void main()
{ clrscr();
int a;
printf("\nEnter the number of tickets:");
scanf("%d",&a);
for(int i=0;i<a;i++)
{ printf("\nEnter name[%d]:",i+1);
scanf("%s",&passengerinfo[i].name);
printf("\nEnter age[%d]:",i+1);
scanf("%s",&passengerinfo[i].age);
}
printf("\nThe boarders of the boats:");
for(i=0;i<a;i++)
{ printf("\nName:%s",passengerinfo[i].name);
printf("\tAge:%d",passengerinfo[i].age);
}
getch();
}>
[\code]
I am able to type the name and age but my output comes as:
Name: Age:
Name: Age:
which is not what I want.Nothing is printed against the Name and Age.Please help me.Thanks.