My code is running successfully but it is showing runtime error.
int i,N, S[N],T;
if(T>=1 && T<=10)
void size(int S,int n)
Why you people don’t provide question links. It really helps alot to understand the code after knowing what its purpose is to do and yaa please provide solution link or post your solution using codesample option in the editor
there are languages that cannot be provided in the editor, I tried to open Dlang in the editor, and it stuck at loading
You have declared the variable N and not initialized it so it takes garbage value. After that you have declared the array with size N which i am really doubtful about.
According to me you should always declare your array after taking the size input. I did that and your code runs fine.
So i might have not told you the reason of runtime error but i have definitely told you the solution i.e. declare the array after taking N as input.
but the size of an array must be a constant ?, or is this one of GCC’s extension ?
I believe this feature was introduced in C99 if i correctly remember my programming with C lectures
I am not so sure though but declaring array after the size has been taken input seems logical to me and more importantly it always works. :xD