Hey all. I wrote this program for an online contest. It RUNS FINE on Bloodshed's Dev-C++ but it breaks down with GCC. The contest demands all solutions based on GCC compiler.
It doesn't even wait for the 2nd input. The program worked fine on Dev-C++. Please, help.
#include <stdio.h>
int testCases;
void runPgm()
{
scanf("%d", &testCases);
int array[testCases][2];
char start[testCases];
int i;
for(i=0; i<testCases; i++)
{
scanf("%c %d %d", &start[i], &array[i][0], &array[i][1]);
}
for(i=0; i<testCases; i++)
{
printf("%c %d %d\n", start[i], array[i][0], array[i][1]);
}
}
int main() {
runPgm();
return 0;
}
Output with GCC:
machine:~$ cc prog.c -lm
machine:~$ ./a.out
2
a 3 3
0 -1080493616
a 3 3
machine:~$