Re: i know is off of topic, but...



Mario Motta wrote:
hi all,
someone can tell me why this piece of sw compile and works even if it should not ?

$ gcc --version
gcc (GCC) 3.3.1 (mingw special 20030804-1)
$ gcc impossible.c -o impossible

======================================================
#include <stdio.h>

int main(int argc, char *argv[])

{
int n,lv;
printf("enter lv:");
scanf("%d",&lv);
int impossible[lv];  // declaring an array without a constant size ?

This is a C89 GNU extension and standard in C99.

for(n = 0; n < lv; n++)
  {
    impossible[n] = n+10;
    printf("\nimpossible[%d] = %d",n,impossble[n]);
    fflush(stdout);
  }
return 0;
}

TIA

/mario



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]