Home

A program to explain NESTED STRUCTURE

C Programming Language 091

Program

#include <stdio.h>

struct A
{
    int x;
};

struct B
{
    int y;
    struct A a;
};

int main()
{
    struct B b;
    b.a.x = 10;
    b.y = 20;

    printf("x = %d, y = %d", b.a.x, b.y);
    printf("\n");

    return 0;
}

Result

x = 10, y = 20


Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments