Professional Documents
Culture Documents
What is a variable?
• Each variable must be defined before you
can use it inside your program.
• Did you ask yourself why we have to
declare variables?
– First reason is To allocate memory
– Second reason is Instruct compiler how
to treat this memory
location ML? As int or
float...
What is a variable?
int main() Three MLs have been
{ allocated. The first ML
int x = 16; holds int value. The
float y = 2.3; second ML holds
char z = 70; floating-point number.
. The last ML holds one
. byte integer.
.
}
x 10
ptr &x
x = 10 HOW!!!!
x = 10;
ptr = &x;
*ptr = *ptr + 1;
printf(“x = %d\n”, x);
}
What is Asterisk ( * )?
char *z = *x*y;
!!?*&%^z*int-xy