This is working code.
Also depending on what you are trying to do you may need to remove the newline character that fgets() will usually take at the end of the input stream.
Code:
#include <stdlib.h>
#include <stdio.h>
void Remove_Newline(char * data);
int main()
{
char *names[30];
names[0] = (char*)malloc(sizeof(char) * 31);
if (!names[0]) return 0;
names[1] = (char*)malloc(sizeof(char) * 31);
if (!names[1]) {
free(names[0]);
return 0;
}
fgets(names[0], 30, stdin);
fgets(names[1], 30, stdin);
printf("%s\t%s", names[0], names[1]);
free (names[0]);
free (names[1]);
return 0;
}