'My int is not taking the value of another int. This is in C, using visual studio
I cannot understand why image[i][j].rgbtBlue in the below code will not take the value of debug_blue_third. I'm probably making a stupid error, but I've been trying to figure it out for hours so any help is really appreciated.
while(x < 9){
image[i][j].rgbtBlue = debug_blue_third;
printf("\n image[i][j].rgbtBlue is %i", image[i][j].rgbtBlue);
printf("\n debug blue first is %i", debug_blue_first);
printf("\n debug blue second is %f", debug_blue_second);
printf("\n debug blue third is %i", debug_blue_third);
The terminal prints the following.
image[i][j].rgbtBlue is 66
debug blue first is 104000
debug blue second is 322.490295
debug blue third is 322
Solution 1:[1]
You do not provide the types but seeing your code is very easy to guess.
- 322 in hex is 0x142
- 66 in hex is 0x42
so rgbtBlue is only one byte long and debug_blue_third is at least 2 bytes long. Assigning 0x142 to an unsigned byte will result in 0x42.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 0___________ |
