what is : int x and int 0x80

how does the compiler/assembler differenciate between those two commands ,
is because one starts with a number ??
The

`int x`

reserves (usually) 4 bytes for a decimal number;

`int 0x80`

`0x` stands for hexadecimal, and `80` is just 128 in decimal.

EDIT: also it is mainly used to manipulate bits so unless you're doing that, then you won't be needing octal or hexadecimal in your programs.
Last edited on
0x prefix means that what follows is a number in hexadecimal format.
0x80 means: 00000000 00000000 00000000 10000000 (little endian notation)
in linux kernel :
we use "int 0x80" for calling interrupt (in this case system_call)
how can you explain that ?
why didn't the compiler declared it as integer instead it called an interrupt ??

thnx for the quick replay
`int 0x80;` is not valid C++. It will give you an error in any C++ compiler. Variables cannot be in "hexadecimal form". hexadecimal/decimal/octal/binary forms are merely different textual representations of the same number. They do not change how that number is stored in the computer.

`int x;` creates a variable of type 'int' which is named 'x'.

`x = 0x80;` assigns the hexadecimal value \$80 to the variable 'x'. In this case it is basically the same as saying this: `x = 128;`

mIXpRo wrote:
in linux kernel :

The Linux kernel has absolutely nothing to do with C++. It can (and apparently does) mean something entirely different in that context and trying to compare the two is pointless.
mIXpRo,

int 0x80 is assembly, it has nothing to do with the compiler.

int x; creates a variable of type 'int' which is named 'x'.

x = 0x80; assigns the hexadecimal value \$80 to the variable 'x'.
xander337