| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | RE: [C] typecasting |
From: "Roger Scudder"
If the goal is (as you wrote) to 'get rid of the negative sign' take a look
at the abs() function.
-Roger
-----Original Message-----
From: c-bounces{at}snippets.org [mailto:c-bounces{at}snippets.org] On Behalf
Of Jay B
Sent: Friday, April 23, 2004 10:46 PM To: c{at}snippets.org
Subject: [C] typecasting
Hey, I got the following code:
int main(void) {
int i = -33;
printf("%d\n", i);
printf("%d\n", (unsigned int)i);
return 0;
}
I get -33 for both, why? Since I'm typecasting the second as an unsigned
int, shouldn't it get rid of the negative sign?
Thanks.
--
______________________________________________
Check out the latest SMS services {at} http://www.linuxmail.org This allows
you to send and receive SMS through your mailbox.
Powered by Outblaze
_______________________________________________
C mailing list
C{at}snippets.org
http://www.snippets.org/mailman/listinfo/c
Gateway to the FidoNet C_Echo
--- BBBS/LiI v4.01 Flag-5
* Origin: Prism's_Point (1:261/38.1)SEEN-BY: 633/267 270 @PATH: 261/38 123/500 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.