-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.1Structures.c
More file actions
40 lines (38 loc) · 840 Bytes
/
1.1Structures.c
File metadata and controls
40 lines (38 loc) · 840 Bytes
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
//Structure is a way of group of variables
//Strcutures is a collection of dissimilar elements
//defining structures means creating new data type
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
struct myinfo
{
char name[20];
int age;
int rank;
};
struct myinfo input(){
struct myinfo temp; //create new data type
fflush(stdin);
printf("Enter Your name :");
gets(temp.name);
printf("\nEnter your age :");
scanf("%d",&temp.age);
printf("\nEnter your rank :");
scanf("%d",&temp.rank);
return temp;
}
void display(struct myinfo data){
printf("\n Your Name is: %s ",data.name);
printf("\n Your Name is: %d",data.age);
printf("\n Your Name is: %d",data.rank);
}
int main()
{
struct myinfo mydata;
mydata=input();
display(mydata);
getch();
return 0;
//by Navjot Singh Prince:)
}