Arrays in VC++ RRS feed

  • Question

  • I find that the below works in VC++, and I find it surprising. Can anybody explain why it should not fail with a segmentation fault?

    int a[10]={0};

    a[100]=2;  // works ???

    int b=a[50];  ///works ???

    int* c=new int[30];

    c[50]=2;  //works ???

    int d=c[36];  //works ???

    • Edited by ajaxsql Friday, September 28, 2012 7:47 PM
    Friday, September 28, 2012 7:41 PM