0
Help me with this Output.
int main() { int sub[50], i ; for ( i = 0 ; i <= 48 ; i++ ) ; { sub[i] = i; printf ( "\n%d", sub[i] ) ; } } output is 49
4 Respuestas
+ 3
Sri pranavi Donapati It will give error because there is semicolon (;) after for loop. If you remove semicolon then output will be 0 to 48 not only 49
+ 3
Sri pranavi Donapati Why there would be garbage value if there is already sub declared with size of 50.
And if you see the program you are actually printing the value of i.
Just run the program in Sololearn Playground and see what happens.
0
Remove the semicolon after the for loop ,
int main()
{
int sub[50], i ;
for ( i = 0 ; i <= 48 ; i++ )
{
sub[i] = i;
printf ( "\n%d", sub[i] ) ;
}
}
0
AJ Anant #G3 why can't that error only be 49 ,why can't it be any garbage value?