C Structure

Structure is a entity that handle all
different type of data type at the same time.

Syntax of Structure

struct name
char name;
float price;
int total;
struct name a1,a2,a3;

Explanation :

We should use the struct keyword, and after that give the name of structure.
Then in the body part of structure, we declare different data type.
In the Above Example we have char, float, int data type in the one structure.
after the body of structure, we declare name of variable belongs to
the name structure.

Program to find the Simple Interest using Structure.

void main()
int si;
struct simpleinterest
int p;
float r;
int t;
float si;
struct  simpleinterest  p1;
printf(“\nEnter the principle, rate and time for simple interest\n”);
scanf(“%d %f %d”,&p1.p, &p1.r, &p1.t);
printf(“\n The value you entered is : %d “, si);


Follow Us

Contact Us


Back to Top