#include<conio.h>
#include<stdio.h>
#include<string.h>
struct stud
{
char name[25];
int roll;
int marks;
}s;
void main()
{
int i;
clrscr();
struct stud s1,s2,s3;
printf("\n Enter your name\t\t:\t");
scanf("%s",&s1.name);
printf("\n Enter your Roll No\t\t:\t");
scanf("%d",&s1.roll);
printf("\n Enter your 5 subject marks\t:\t");
scanf("%d",&s1.marks);
clrscr();
// Copy structure method 1
strcpy(s2.name,s1.name);
s2.roll=s1.roll;
s2.marks=s1.marks;
// Copy structure method 2
s3=s1;
printf("\n Your Entire Details are");
printf("\n Nmae \t Roll No\t Marks");
printf("\n %s\t %d\t %d \t\b",s1.name,s1.roll,s1.marks);
printf("\n\n %s\t %d\t %d \t\b",s2.name,s2.roll,s2.marks);
printf("\n\n %s\t %d\t %d \t\b",s3.name,s3.roll,s3.marks);
getch();
}
No comments:
Post a Comment