473,382 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

confusion of storing variable?

would anyone tell me when we take a variabel suppose int a; is it create a memory space? when we access a variable with oject .variablename how it shows the value .please, tell how it works in respect or RAM.
Nov 25 '10 #1
5 1352
whodgson
542 512MB
once the variable is initialised it is assigned memory according to its type for a time according to its scope.
Nov 25 '10 #2
Thanks. I also want to know how does it stores variable in ram like in structure it stores one after another and in union it stores from one location? plz. send reply i am confused when i do implemention of programm.
Nov 25 '10 #3
Banfa
9,065 Expert Mod 8TB
That is entirely implementation dependent, the C and C++ standards impose no requirements on the way any given platform chooses to store the data it uses in memory.

If you want an answer at the very least you are going to have to give a lot more detail of what you are doing and what you are trying to understand.
Nov 25 '10 #4
whodgson
542 512MB
Please follow Banfa from now as my understanding limited.
Nov 26 '10 #5
donbock
2,426 Expert 2GB
The C Standard imposes certain minimal constraints, such as a short must be able to hold values in at least the range -32768 to 32767. A compiler is free to do whatever it wants as long as it satisfies the minimal constraints. For example, there is no constraint that compilers must use two's-complement encoding for integers.

The Standard imposes no constraint on the order in which variables are allocated in memory.

The Standard permits union members to overlap in memory, but I don't recall there being a definite requirement to do so. That is, a lazy compiler could choose to treat union as a synonym for struct.

The point is that these sort of details vary widely between compilers. There is no answer that is both general and accurate.

If you want a general answer then you need to say so; if you want an accurate answer then you need to tell us which specific compiler you need an answer for.
Nov 26 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: chris | last post by:
Hello, I am currently writing a simulation system which involves a large number of C++ classes, many of which contain pointers to other objects. I need the ability to save the state of the...
7
by: Snyke | last post by:
Well my problem is simple: I have a class which has a variable number of members. Lets say I have a class Family and a variable number of FamilyMembers. Until now I used a member of Family called...
4
by: matevz bradac | last post by:
Hi, I'm trying to implement delayed function execution, similar to OpenGL's display lists. It looks something like this: beginList (); fcn1 (); fcn2 ();
14
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I...
5
by: - Steve - | last post by:
I have a website that uses forms based authentication. In the logon.aspx page a user enters a username and password. It is then authenticated against Active Directory. After that point on any...
2
by: prasanthag | last post by:
Hi, I am a newbie to this group. I have a problem in handling the variable arguments passed to a function. My requirement is like this. I have 2 functions say, void funcX(int i, int j);...
3
by: prasanthag | last post by:
Hi, I am a newbie to this group. I have a problem in handling the variable arguments passed to a function. My requirement is like this. I have 2 functions say, void funcX(int i, int j);...
10
by: John Salerno | last post by:
If I want to have a list like this: where the first part of each tuple is a variable name and the second part is a label for the user to see, such as a form like this: First Name: ________...
3
by: friendkitty | last post by:
Hi All, I m a new member here.I am now writing a program that render Vertex Normals.I m now trying to implement a data structure that will best suit computing vertex normals.For that computation ,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.