P184. Program to allocate dynamic memory for 5 strings, scan it and print it.
#include<stdio.h>
#include<stdlib.h>
void
main()
{
char *p[5],i;
for(i=0;i<5;i++)
{
p[i]=malloc(sizeof(char)*10);
scanf("%s",p[i]);
}
for(i=0;i<5;i++)
printf("%s\n",p[i]);
}
Comments
Post a Comment