i'm using turbo c++ 4.5,,

now i have structure like this :

struct  name{
	char firstName[15];
	char lastName[15];
};

struct student{
	char id[11];
	name n;
	float ipk;
	char major[15];
};

struct student s[5];

how to make function to fill and to printf the s[]?
thanks alot for helping me, and sorry for my bad english..

create a loop then prompt to input each of the fields.

for(i = 0; i < 5; i++)
{
    printf("Enter id ...\n";
    fgets( s[i].id, sizeof(s[i].id), stdin);
    // etc etc for each of the fields
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.