> it just comes out -1. i don know why....
You need to use %u to correctly print the value of an unsigned int, not %d which is for (signed) int. Try that.
Edit: The same goes for scanf(). Study carefully the conversion characters for printf() and scanf() for unsigned vs. signed types.