why does the array doesn't get initialized by global variable , even though it should not?

Posted by ashish yadav on Stack Overflow See other posts from Stack Overflow or by ashish yadav
Published on 2010-03-11T17:48:37Z Indexed on 2010/03/11 17:49 UTC
Read the original article Hit count: 208

Filed under:
|

why does the array a does not get initialized by global variable 'size'.

include

int size=5; int main() { int a[size]={1,2,3,4,5}; printf("%d",a[0]); return 0; } the compilation error is shown as "variable-sized object may not be initialized". according to me the array should get initialized by 'size'. i apologize if i am not clear but i feel i have expressed myself well enough. thank you!!!!!!!!!!!

© Stack Overflow or respective owner

Related posts about c

    Related posts about global-variables