I am very new to the C programming language and I am working on a project that involves reinitializing a varialbe(s).
Could someone clue me in how to do this, I am confused
I am very new to the C programming language and I am working on a project that involves reinitializing a varialbe(s).
Could someone clue me in how to do this, I am confused
You can say, for example:
i=0;
anywhere in the program - you just have to declare them at the beginning; the values can (usually) be changed anywhere.
-Govtcheez
[email protected]
If you initialize like so:
int i = 5;
Then, anywhere that the integer i is in scope, you can change its value:
i = 2;
i=0;
But if you declare the integer as constant:
const int i = 5;
The compiler won't let you put another value into this variable.
i = 8 // compiler will bomb here.