In: Computer Science
create an array with a bunch of animal
lets see the answer :-
lets see a c program to create a bunch of animal using array
#include<stdio.h>
struct animal {
char name[100];
};
int main( )
{
int i,n;
printf("Enter how many animal records u want to store :: ");
scanf("%d",&n);
struct animal stuarr[n];
printf("Enter name of animal :: \n");
for(i=0; i<n; i++)
{
printf("\nEnter %dst animal record :: \n",i+1);
printf("Enter Animal Name :: ");
scanf("%s",stuarr[i].name);
}
printf("\n\tArray of animal\t\n");
for(i=0; i<n; i++)
printf("\t%s\n", stuarr[i].name);
return 0;
}
output: