0

Array error

#include <stdio.h> int main() { int n; printf("Introduce el número de elementos: "); scanf("%d",&n); int mat[n]; return 0; } Why doesn"t this code accept 'mat' array? In other compilers accept it.

16th Mar 2022, 10:47 AM
Manuel Rondón
Manuel Rondón - avatar
5 Respostas
+ 1
because it is unused. The compiler is throwing warning because it wants to tell you that if you are not going to use a variable/array then why are you even declaring it ?🤔🤔 either use that array or remove it.
16th Mar 2022, 1:07 PM
NonStop CODING
NonStop CODING - avatar
+ 1
It's not error. It's a warning. Manuel Rondón
16th Mar 2022, 2:27 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 yeah correct!
16th Mar 2022, 2:33 PM
NonStop CODING
NonStop CODING - avatar
0
I mean in other compilers no warning no error.
16th Mar 2022, 8:39 PM
Manuel Rondón
Manuel Rondón - avatar
0
May be, there others disabled warnings in settings.. And It has no errors.
16th Mar 2022, 8:47 PM
Jayakrishna 🇮🇳