This code gives error. I found this code in C++ forum but when i tried to run the simplest form it also gave me error. That's why i started a new thread.
ErrorsCode:#include <stdio.h> #define a 10 int main(void) { const int s=26; int arr[s]; }
But when i replace s with a, which is #defined the error is rectified. Why is this so? 's' being a constant identifier , should not give errors.Code:Error 1 error C2057: expected constant expression Error 2 error C2466: cannot allocate an array of constant size 0 Error 3 error C2133: 'arr' : unknown size