Structure in C


A structure is a user defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type.

Source Code

//Structure in C
#include<stdio.h>
struct student
{
    char *name;
    int age;
    float per;
};
int main()
{
    struct student o,o2;
   /*
    printf("\nSize of Struct : %d",sizeof(o));//4
    printf("\nSize of char : %d",sizeof(char));//4
    printf("\nSize of int : %d",sizeof(int));//4
    printf("\nSize of float : %d",sizeof(float));//4
    */
    o.name="Tutor Joes";
    o.age=30;
    o.per=85.5;
 
    printf("\nName        : %s",o.name);
    printf("\nAge         : %d",o.age);
    printf("\nPercent     : %f",o.per);
 
    return 0;
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes