Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4155

deletion of an array expression without using the array form of 'delete'

The array form of delete should be used to delete an array. This warning occurs only under ANSI-compatibility (/Za).

The following sample generates C4155:

// C4155.cpp
// compile with: /Za /W1
#include <stdio.h>
int main(void)
{
   int (*array)[ 10 ] = new int[ 5 ] [ 10 ];
   array[0][0] = 8;
   printf("%d\n", array[0][0]);
   delete array;   // C4155
   // try the following line instead
   // delete [] array;   // C4155
}
Show:
© 2014 Microsoft