C Program using structure


In this program, You will learn how to create a simple structure program in C.


struct Test { int x, y; };


Example: How to create a simple structure program in C

Run it Now
#include<stdio.h>

struct Test {
    int x, y;
};

int main() {

    struct Test t;

    t.x = 10;
    t.y = 20;

    printf("The x value is : %d", t.x);
    printf("\nThe y value is : %d", t.y);

    return 0;
}

Output:

The x value is : 10
The y value is : 20