[question]unsigned number with negative value?

Hi everyone,

I am confused about the definition of the **unsigned**. Could anyone please help to explain the result of running a simple test code. As below.

Code:

void main()

{

unsigned long num_a = 4;

unsigned long num_b = 8;

unsigned long num_c;

unsigned long num_d = 1;

num_c = num_a-num_b;

num_d -= num_c;

printf(" num_c = num_a - num_b, num_c is: %ld num_d is:%ld" , num_c, num_d);

}

**The result is**: num_c = num_a - num_b, num_c is: **-4** num_d is:5

I thought **num_c** is declared as an **unsigned **long but it can actually present a negative number. I guess I don't have the correct understanding of the unsigned number.

**question 1**. for "num_c = num_a-num_b", (num_c = 4-8), can num_c, an unsigned long integer, carry a negative value? why?

**question 2**. for "num_d -= num_c;" num_c has a unsigned long type, but is assigned to a negative number as the result of the arithmetic, would any potential side effect be introduced if continue to use num_c in the function?