简体   繁体   中英

Reassign new hex value into Uint32 *

I have the following code snippet which reads the pixel value in hex format.

Uint32* MyPixel = pixels + ( (iH-1) + image->w ) + iW;
printf("\npixelvalue is  is : %x",*MyPixel);

How can I reassign a new hex value into the *MyPixel cause I tried this does not work.

*MyPixel = "00FF00"; 

"00FF00" is a string literal. You need a hex integer literal:

*MyPixel = 0x00FF00;

Prefix 0x tells the compiler that the rest of the numeric literal needs to be interpreted as a numeric hex constant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM