char 8bit wide or 7bit wide in c++?

W

Web Developer

Hi,

Have a book that says a char in c++ is 8bit wide. But i remember reading
that C++ uses ANSI character set which uses 7bit per character. Who is
right?


WD
 
J

John Harrison

Web Developer said:
Hi,

Have a book that says a char in c++ is 8bit wide. But i remember reading
that C++ uses ANSI character set which uses 7bit per character. Who is
right?

Neither. In fact every statement about C++ above is wrong. Here's the truth.

In C++ a byte must be at least 8 bits. A char must be a single byte.

C++ does not use the ANSI character set (maybe you mean ASCII?), it might,
but it does not have to, it could use a completely different character set.

Even if C++ did use a seven bit character set, then it would do so in a
eight bit character (probably) and just ignore the extra bit.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,137
Messages
2,570,802
Members
47,348
Latest member
Mikientp

Latest Threads

Top