Size of character ('a') in C/C++

前端 未结 4 1248
天命终不由人
天命终不由人 2020-11-22 03:08

What is the size of character in C and C++ ? As far as I know the size of char is 1 byte in both C and C++.

In C:

#include 

        
4条回答
  •  后悔当初
    2020-11-22 03:21

    As Paul stated, it's because 'a' is an int in C but a char in C++.

    I cover that specific difference between C and C++ in something I wrote a few years ago, at: http://david.tribble.com/text/cdiffs.htm

提交回复
热议问题