How to write integers with write() function in C?

M

MattSales

Guest
I'm a noob on C and trying to use write() function to show an integer.

These is my code:

int n = 7;
write(1, &n, 4);


I want to show 7, but the program shows nothing or other strange character when I set n to a big number.

What am I missing?

Continue reading...
 
Top