0
 #include <stdio.h>
 int main(void)
 {
    int n,i;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        a[i]=i;
    printf("%d",a[i]);

    }
    for(i=0;i<n+1;i++)
    {
        a[i]=i;
        printf("%d",a[i]);

    }       
    return 0;   
 }

here if we give any input eg 5 then output is... 01234012345 here question is that code should give an error but insted it prints 5 which is stored in a[5] & a[5] is undeclared

Jens
  • 69,818
  • 15
  • 125
  • 179
SID_J
  • 23
  • 3

0 Answers0