Why doesn't this C program compile? What is wrong with this?
I have tried it on wxDevC++
and Turbo C++ 3.0.
Main.c
#include<stdio.h>
#include<conio.h>
const int SIZE = 5;
int main(int argc, char ** argv)
{
char array[SIZE] = {'A', 'B', 'C', 'D', 'E'};
printf("Array elements are,\n");
int i=0;
for(i=0 ; i<SIZE ; ++i)
{
printf("%c ", array[i]);
}
getch();
return 0;
}
Error Messages on the both of the compilers are similar.
f:\_Source-Codes\main.c In function `main':
8 f:\_Source-Codes\main.c variable-sized object may not be initialized