Answer:
see explaination
Step-by-step explanation:
#include<stdio.h>
#include<stdlib.h>
typedef struct emp // STRUCTURE DEFINITION
{
int id;
char name[50];
}var;
//DISPLAY OF INFORMATION FUNCTION DEFINITION
void display(var *e[],int); // PASSING ARRAY OF POINTERS OF TYPE STRUCTURE AND SIZE OF STRUCTURE
int main()
{
system("clear");
printf("*************** WELCOME TO STRUCTURE PROGRAM *********\\\\");
printf("****** ENTER THE NUMBER OF STRUCTURES REQUIRED\\");
printf("******ENTER THE INFORMATION\\");
printf("******GET THE OUTPUT\\\\");
printf("\\******************************************************\\\\");
int size,i;
printf("ENTER THE NUMBER OF STRUCTURES REQUIRED:");
scanf("%d",&size);
var *temp[size]; // POINTER OF TYPE STRUCTURE DECLARED
for(i=0;i<size;i++)
{
temp[i]=(var *)malloc(sizeof(var)); // MEMORY ALLOCATION AND TYPE CASTING TO STRUCTURE TYPE
printf("ENTER THE ID OF THE STUDENT:");
scanf("%d",&temp[i]->id);
printf("ENTER THE NAME OF THE STUDENT:");
scanf("%s",temp[i]->name);
}
display(temp,size); // CALLING DISPLAY FUNCTION
}
void display(var *e[],int size) // DISPLAY FUNCTION DECLARATION
{
int i;
for(i=0;i<size;i++)
{
printf("\\");
printf("**********************************************\\\\");
printf("ID : %d\t NAME : %s\\\\",e[i]->id,e[i]->name);
printf("**********************************************\\\\");
}
}