Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is C++ backward compatible with ANSI/ISO-C?

ANSI backward compatible
0
Posted

Is C++ backward compatible with ANSI/ISO-C?

0

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 (e.g., the typedef struct Fred Fred; technique still works, but is redundant in C++).

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.