Global Structure and Variable

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

};

struct anik std1, std2;

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

    printf("Enter Second Student Information : \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("\nSecond Student : \n");
    printf("Name : %s\n", std2.name);
    printf("Age : %d\n", std2.age);
    printf("Phone Number : %s\n", std2.phnnum);

    return 0;
}

Comments