-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,164
  • 4
  • 29
  • 55
user492922
  • 895
  • 1
  • 11
  • 23

1 Answers1

1
  • sizeof('c') — 1 in C++, same as sizeof(int) in C.
Jonathan Leffler
  • 698,132
  • 130
  • 858
  • 1,229