0

How exactly do variables work?

14th Aug 2016, 3:57 PM
Jamie Schiantarelli
Jamie Schiantarelli - avatar
3 Answers
+ 1
variables are just names given to a part of the memory, like if you want to take integer values from a user for finding their average, first you have to declare a variable of integer type to hold the values.
14th Aug 2016, 5:19 PM
Simant |Kingpin|
Simant |Kingpin| - avatar
+ 1
whenever we declares a variable it allocate a space in memory. for example: int a; As soon as compiler reads(compile) this code it allocate a space of 2 byte in memory. similarly, if we write long q; then compiler allocate a space of 4 byte in memory. similarly, double b; will allocate 8 byte of memory. Here a,q and b are names given to that memory .
21st Aug 2016, 4:37 AM
sandeep_mandal
0
variables allocates different spaces in RAM. So values of them physically stored as ones and zeros
14th Aug 2016, 5:21 PM
Bekir Uzun
Bekir Uzun - avatar