I am trying to use a variable that will have a HEX value. I have tried using char s[4] but this doesn't work in the command outportb(address,address).
Any idea what I could use?
I am trying to use a variable that will have a HEX value. I have tried using char s[4] but this doesn't work in the command outportb(address,address).
Any idea what I could use?
addr = 0x40a;
For example.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
declare 4 separate variables who'll be able to contain hexadecimal numbers from 0x00 to 0xFF (in most implementation).Code:char s[4];
Why would you need to declare 4 seperate variables? Hexadecimal is only a different representation. The number held would still be the same. IE:char s[4];
declare 4 separate variables who'll be able to contain hexadecimal numbers from 0x00 to 0xFF (in most implementation).
Code:#include <stdio.h> int main() { char a = 0x41; printf("Hex: %x\n", a); printf("Decimal: %d\n", a); printf("ASCII: %c\n", a); getchar(); }