Works in c but gives error in C++ -
the below code give no compilation error when used c file , gives error when used cpp file.
#include <stdio.h> #include <stdlib.h> int *delete(int a,int b) { int *p; p=&a; return p; } int main() { return(0); }
error in c++ file:
- syntax error
- expected unqualified id before delete
- expected initializer before delete
in c++, "delete" keyword(operator) used free dynamically allocated memory. cannot used name user defined functions.
Comments
Post a Comment