/* program to accept and print 5 strings using pointers */
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 100
int main()
{
char **s;
int i;
s = (char *)malloc(sizeof(char)*5);
for(i=0;i<5;i++)
{
*(s+i) = (char *)malloc(sizeof(char)*SIZE);
}
printf("enter 5 strigs\n");
for(i = 0;i<5;i++)
{
fgets((s+i),SIZE,stdin);
}
//printing the strings
for(i = 0;i<5;i++)
{
puts((s+i));
}
return 0;
}
This program accepts 5 strings from keyboard and prints on screen.It works properly but shows many warnings.Is there any other ways to do same operation(using pointers only).please suggest me.