You are on page 1of 1

void main()

void main()
{
{
struct student
struct student
{
{
char name[30];
char name[30];
int roll;
int roll;
float marks;
float marks;
};
};
struct student s1={"ABC",15,78.5f},s2,s3={0};
struct student s={"ABC",12,78.5}, *p;
clrscr();
int i=0;
clrscr();
printf("\n-----Name: %s",s1.name);
printf("\nRoll No.: %d",s1.roll);
p=&s;
printf("\nMarks: %f",s1.marks);
printf("\n\n\n-----Name: %s",s.name);
printf("\nRoll No.: %d",s.roll);
//s2.name=s1.name;
printf("\nMarks: %f",s.marks);
strcpy(s2.name,s1.name);
s2.roll=s1.roll;
printf("\n\n\n-----Name: %s",p->name);
s2.marks=s1.marks;
printf("\nRoll No.: %d",p->roll);
printf("\nMarks: %f",p->marks);
printf("\n\n\n-----Name: %s",s2.name);
printf("\nRoll No.: %d",s2.roll);
printf("\nMarks: %f",s2.marks);
getch();
}
s3=s1;
void main()
printf("\n\n\nName: %s",s3.name);
{
printf("\nRoll No.: %d",s3.roll);
struct student
printf("\nMarks: %f",s3.marks);
{
char name[30];
getch();
int roll;
}
float marks;
};
struct registration
-----Name: ABC
{
Roll No.: 15
struct student s;
Marks: 78.500000
long int regno;
};
struct registration r={"ABC",12,56.3,11716352};
-----Name: ABC
Roll No.: 15
clrscr();
Marks: 78.500000
printf("\n\n\n-----Name: %s",r.s.name);
printf("\nRoll No.: %d",r.s.roll);
Name: ABC
printf("\nMarks: %f",r.s.marks);
Roll No.: 15
printf("\nReg No.: %ld",r.regno);
Marks: 78.500000
getch();
}

You might also like