Code C hợp lệ nhưng lỗi C++:
- K&R function definition:
void f(x,y)int x;int y;{}→ C++ lỗi - Implicit int:
const x=10;→ C++ lỗi "does not name a type" - Tên trùng lặp global:
int x; int x;→ C++ lỗi "redefinition" - void* gán ngầm:
int* p = malloc(...);→ C++ cần cast - Hàm không tham số:
void f(){} f(1,2);→ C++ lỗi "too many arguments"