The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
301 views
I saw on http://www.cquestions.com/2009/06/memory-representation-of-int-data-type.html  but it seems wrong to me. Please clarify.
asked in Programming by (421 points) | 301 views

2 Answers

+1 vote

That is correct except for one extra 1 which seems to be a typo. 

0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

This will be the representation of int a = 7, assuming sizeof int is 4 bytes and a little endian machine (start address of memory is from the left).

Why is there a confusion?

answered by Boss (18.3k points)
0
i think you are telling big endian representation.
0

No. Its little endian. The least significant byte occupies the first byte of the address. In big endian, the most significant byte occupies the first byte of the address. int a = 7 in big endian will be
 

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
0 votes

Related questions

0 votes
0 answers
1
asked Jun 8 in Programming by saumya mishra Active (1.5k points) | 33 views
+1 vote
3 answers
3
0 votes
1 answer
5
+1 vote
1 answer
6
asked Aug 1, 2017 in Databases by Arjun Kumar 1 (103 points) | 172 views


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,463 questions
49,921 answers
165,477 comments
65,899 users