-2

What are examples of syntax that is valid in both C and C++ but has different semantics? Put another way, what are examples of programs that produce different output when compiled with C and C++ compilers?

8bitcat
  • 2,206
  • 5
  • 30
  • 59
user492922
  • 925
  • 2
  • 12
  • 23

1 Answers1

1
  • sizeof('c') — 1 in C++, same as sizeof(int) in C.
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278