HI,
I am using the DJGPP compiler for C found at http://www.delorie.com/djgpp/
I have the following problem. I am learning C right now and there is this example of a simple program, it creates a main function and two additional fuctions, which should demonstrate that variables are not carrying the same value in different functions (here() & there())
The program is supposed to print out:
The value of v here is 30
The value of v there is 1234 //some other random number BUT NOT 35
when i run the program though it DOES print:
The value of v here is 30
The value of v there is 35
code:
#include <stdio.h>
void here(void);
void there(void);
void main()
{
here();
there();
}
void here()
{
int v;
v=6*5;
printf("The value of v here is %i\n",v);
}
void there()
{
int v;
v+=5
printf("The value of v there is %i\n",v);
}
Why does it print 35 if the book tells me that it won't definitly do so??? And why does the variable v stores the value 30 along into the other function if i should not happen, according to the book (C for dummies vol 1, by the way)???
thanks...