Re: [Dev-C++] Error while doing a simple example
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2003-05-20 21:34:51
|
The example code assumed 16-bit integers, but our beloved gcc port is
using 32-bit integers.
Change your declarations to:
short x;
unsigned short y;
and test again.
/Per W
On Tue, 20 May 2003, Christian Schmidt wrote:
> Hi,
>
> >From the book learn C in 24 hours I typed this lesson and build/run it:
>
> #include <stdio.h>
>
> main ( )
>
> {
>
> int x;
> unsigned int y;
> x = 0xAB78;
> y = 0xAB78u;
>
> printf ("De decimal value of 0xAB78 is: %d.\n", x);
> printf ("De decimal value of 0xAB78u is: %u.\n", y);
>
> return 0;
>
> }
>
> However this returns me for both statments (printf's): 43896 but the book
> tells me it should return -21640 for the signed integer (first printf).
>
> I'm using:
>
> Windows 2000 SP3
> PIII 550 MHz
> DevC++ 4.9.8.0
>
> Could anyone tell where my mistake is?
>
> Thanks in advance.
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ObjectStore.
> If flattening out C++ or Java code to make your application fit in a
> relational database is painful, don't do it! Check out ObjectStore.
> Now part of Progress Software. http://www.objectstore.net/sourceforge
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|