I want to initialise everything as zero, however my array is declared like this:
where x is a non zero positive int, but I get the error message:Code:int test[x] = {0};
58 C:\Documents and Settings\jb\My Documents\a.c variable-sized object may not be initialized
58 C:\Documents and Settings\jb\My Documents\a.c [Warning] excess elements in array initializer
58 C:\Documents and Settings\jb\My Documents\a.c [Warning] (near initialization for `test')
However when i declare it using:
it works fine, any ideas?Code:int test[5] = {0};
Thanks