Local Structure

#include<stdio.h>
int main()
{
    struct anik
    {
        char name[100];
        int age;
        char phnnum[15];

    };

    struct anik std1, std2;

    printf("Enter Information For First Student : \n");
    printf("Name : ");
    scanf("%s", std1.name);
    printf("Age : ");
    scanf("%d", &std1.age);
    printf("Phone Number : ");
    scanf("%s", std1.phnnum);

    printf("\nEnter Information For Second Student : \n");
    printf("Name : ");
    scanf("%s", std2.name);
    printf("Age : ");
    scanf("%d", &std2.age);
    printf("Phone Number : ");
    scanf("%s", std2.phnnum);

    printf("\nFirst Student : \n");
    printf("Name : %s\n", std1.name);
    printf("Age : %d\n", std1.age);
    printf("Phone Number : %s\n", std1.phnnum);

    printf("\nFirst Student : \n");
    printf("Name : %s\n", std2.name);
    printf("Age : %d\n", std2.age);
    printf("Phone Number : %s\n", std2.phnnum);


    return 0;
}

Comments