• Post Reply Bookmark Topic Watch Topic
  • New Topic

How the values are stored?

 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

This is a very basic question. Consider the following code snippet.

int a = 5;
int b = 1;

How the value 5 is stored inside memory. Since int are 32 bit values will it be stored like

0000 0000 0000 0000 0000 0000 0000 0101.
if i am correct about this, then while performing an operation like this,
int c = ~b;
will it reult in a value like this?
1111 1111 1111 1111 1111 1111 1111 1010.
Please clarify me.
Thanks in advance!
V.dinesh.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, and yes. Everything you've stated is correct.
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!