forked from SarahN18/Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure.c
More file actions
54 lines (41 loc) · 1.04 KB
/
structure.c
File metadata and controls
54 lines (41 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<stdio.h>
#include<string.h>
struct Class{
int number;
char name[20];
float marks;
};
int main(){
int x;
struct Class student1 = {111,"Rao",72.50};
struct Class student2 = {222,"Reddy",67.00};
struct Class student3;
//struct Class student3 = {269,"Rawat",67.00};
student3 = student2;
x = ((student3.number == student2.number) && (student3.marks == student2.marks)) ? 1 : 0;
if(x == 1){
printf("\nStudent2 and Student3 are same\n\n");
printf("%d %s %.1f",student3.number, student3.name,student3.marks);
}
else{
printf("\nStudent2 and Student3 are different");
}
}
#include <stdio.h>
#include<string.h>
struct Class{
char name[30];
char address[50];
};
struct Class student[100];
struct Marks{
int subject1;
int subject2;
int subject3;
};
int main(){
strcpy(student[0].name,"Abhirup Saha");
printf("%s\n",student[0].name);
struct Marks student[3] = {{45,65,76},{76,45,23},{78,89,76}};
printf("%d\n",student[1].subject2);
}