Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • 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
Marshal
Pie
Posts: 24211
35
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic