Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


The sizeof operator

#include "Stdio.h>;

Void main ()
{
Char ch= 'one';
       
Printf ( "%d\n", sizeof (ch));
       
Printf ( "%d\n", sizeof ( 'one'));
}

K&R described in the book : In the formula, each CHAR were converted to INT. So why is the result of one and four VC? I understand this is wrong then?

The sizeof operator

Char in the different systems which are not necessarily the same space occupied by the bar.

The sizeof operator

Ch is a character variable, sizeof (ch) = sizeof (char) is one.

ANSI requirements intger character constant with type int, so sizeof ( 'l') value sizeof (int) of the same value, in your platform, the value of 4.

Wchar_t c is the type of different size and char.

The sizeof operator

Add that in C + +, sizeof ( 'c') value is 1, not C + + int parameters of the characters expansion.



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com