converting signed to unsigned integer

Status
Not open for further replies.

youstron

Newbie level 6
Joined
Mar 5, 2012
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,372
how to convert signed to unsigned integer using mikroC?
 

Is it a positive signed integer?

If so then a simple typecasting would do the job

Code:
unsigned_var = (unsigned int)signed_var

If it is a negative number then typecasting will give a wrong result.

Alex
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…