Is this correct???way of doing??
Hello,
Please anybody here can explain me whether i am doing this correctly or not?i want to create 2 dimesional array of strings with double pointer. Here is the code kindly explain am i doing it fine or is there any mistake in it?
Code:
#include <stdio.h>
#include <string.h>
#include <alloc.h>
int main(void)
{
char **a,i;
clrscr();
a=(char** )malloc(sizeof(char)*10);
for(i=0;i<10;i++)
{
a[i]=(char* )malloc(sizeof(char)*4);
strcpy(a[i],"abc");
printf("%s\n",a[i]);
}
getch();
return 0;
}