want help in C
I am currrently trying to learn C.
in book it states that contant are term that dosent change while execution of progaram......
and variable is name given to the place in computer memory where this constant are stored?
i cant get this fact about variable?
can anyone explain it to me plz..........
The chip can have a constant value placed into a register for computations; the compiler can do this from your constants, so they do not require a memory location unless the constant is an array (string, etc).
most variables (values that can change) do use a memory location unless optimizations decide to use a register (for example, a loop variable that is destroyed when the loop is done).
A variable is a reserved amount of memory to hold data. Variables differ depending on what type of data they will be holding. 'Char' will hold alphabetical data where as a 'float' will hold decimalised data.
i have just started reading book on C
so i cant get you......
i cant really get it..... sorry:confused: :confused: :confused: :confused:
a loop is a kind of function that loops/repeats a certain part of code untill the code reaches 'false'...it then exits the loop to proceed with the rest of the code.
an array is a mass of variables. where as variables are normaly single slots of memory an array is a collection of these slots. arrays are used to simplify refrencing and calling procedures.
***Im also a c++ newby coming from little experience with Vb...so please correct me if im wrong! ***
As process says, arrays are just collections as variables. You probably already know that a variable is like a box - you give it a name, and it can hold a certain type of data. For an array, imagine a row of boxes:
| 0 | | 1 | | 2 | | 3 |
The whole lot is called "array", but is made of four seperate elements: array, array, array and array. We can assign values to these elements just like a normal variable (eg writing "array=65;" puts a 65 into the box marked 2). There can be more than one dimension to an array - for instance the pigeonholes in a hotel could be represented by a row number and a column number (2 dimensional).
That said though, I wouldn't worry too much about arrays until you've got the basics mastered - in the book I've been following I (as a BASIC programmer) was surprised to see them come in quite late (after objects) - but you don't really need them to start with, and you cannot do terribly much with them without knowing things like interation (so you can write a loop that goes to the same bit of code, but moves one element down the array at a time, for instance).
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center