C and C++ are different languages. Not all C-codes work in C++.
Then Is there a code that produces different results between C and C++ sources?
Except for preprocessors and type limits, If it's different depending on the version, please tell me which version works or doesn't work!
c++ c
The following code runs on both C and C++, but results in different results.
int i = sizeof('a');
In C, it's 4
In c++, it's 1.
Another thing is
#include <stdio.h>
int sz = 80;
int main(void)
{
struct sz { char c; };
int val = sizeof(sz);
printf("%d\n", val);
return 0;
}
In c, size of(int) is In c++, sizeof(structuresz).
© 2024 OneMinuteCode. All rights reserved.