Initializing & Accessing the Structure Members 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.

Structure members can be initialized using curly braces '{}'.

Source Code

//Initializing & Accessing the Structure Members in C Programming
 
#include<stdio.h>
 
struct student
{
    char *name;
    int age;
    float per;
};
int main()
{
    struct student o={"Tutor Joes",30,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