UserUserUserUserUser wrote:
when I use variable (printf(a), where's a is char), it gives me random symbols.
The first argument must be a zero terminated string which specifies the formating. Are you sure the compiler didn't gave you a warning about using "printf(a)"?
UserUserUserUserUser wrote:
How to make it say variable value?
Depends on the variable.
Code:
printf("%c\n", a); // print char
printf("%d\n", i); // print integer in decimal
printf("%x\n", i); // print integer in hexadecimal
printf("%s\n", s); // print another string
... etc.
See section "Conversion specifiers" in
man printf.
klange wrote:
At the risk of sounding harsh, this is a very basic C thing and if you don't see how this is wrong you'll have a difficult time moving forward with OS dev.
I don't want to be harsh either, but klange is right.
Cheers,
bzt