I am currently trying to read in two strings s and t that will be input to stdio. They will be input on separate lines.
The following code segfaults.
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
char t[5000000];
char s[5000000];
fgets(t,50000,stdin);
fgets(s,50000,stdin);
printf("%c",t[1]);
}
However, a single fgets doesn't.
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
char t[5000000];
char s[5000000];
fgets(t,50000,stdin);
printf("%c",t[1]);
}
Other posts talk about some return and "/n" issues, but I don't understand what the problem is exactly.