I am trying to convert 65529 from an unsigned int to a signed int. I tried doing a cast like this:
65529
unsigned int
int
unsigned int x = 65
You are expecting that your int type is 16 bit wide, in which case you'd indeed get a negative value. But most likely it's 32 bits wide, so a signed int can represent 65529 just fine. You can check this by printing sizeof(int).
sizeof(int)