Contents Up << >>

Is C++ backward compatible with ANSI-C?

Almost.

C++ is as close as possible to compatible with C, but no closer. In practice, the major difference is that C++ requires prototypes, and that "f()" declares a function that takes no parameters (in C, "f()" is the same as "f(...)"). There are some very subtle differences as well, like sizeof('x') is equal to sizeof(char) in C++ but is equal to sizeof(int) in C. Also, C++ puts structure "tags" in the same namespace as other names, whereas C requires an explicit "struct" (the "typedef struct Fred Fred" technique still works, but is redundant in C++).