Home

A program to explain initialization of structures

C Programming Language 092

Program

#include <stdio.h>

struct bank
{
    char name[15];
    long int accno;
};

void main()
{
    struct bank b = {"John\0", 123456789012};
    printf("Name: %s\n", b.name);
    printf("Account no.: %ld\n", b.accno);

    printf("\n");
}

Result

Name: John
Account no.: 123456789012


Last Updated on

Next Post: Rules vs Guidelines →

Comments