Ask a Question

is every 2's complement number is -ve number in computers memory,if not then why!

on 2012-10-18 16:50:52   by Arka   on Computer Science & Engineering  1 answers

sanchayita

on 2012-10-19 09:30:00  

At the compiler level, the differentiation is based on data type. If the data type is int, then 4 bytes is allocated to that variable (in C). So 15 in 2's complement is 00000000 00000000 00000000 00000000 00001111 while -1 is 11111111 11111111 11111111 11111111 . The compiler then converts this to the corresponding opcode of the CPU. The CPU executes this opcode and at this level everything is in the form of 1s and 0s.