is it possible to declare a function variable further down in the code?
and does it being in a struct have anything to do with how it acts?
This is a discussion on function variables within the C++ Programming forums, part of the General Programming Boards category; is it possible to declare a function variable further down in the code? and does it being in a struct ...
is it possible to declare a function variable further down in the code?
and does it being in a struct have anything to do with how it acts?
What do you mean by 'function variable'?
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
As far as I know, the phrase "function variable" means a variable used in the function, so that is how I will answer your question. You can pass into functions any variable you want, but that variable you pass in must also be declared before the function is called. You must declare and initialize a local variable in the function before you try to access it.
A variable in a struct is just like any other most (all?) of the time, the only real difference is that its been tossed into a bucket.
function variable you know ill link to a apge i use
http://www.zeuscmd.com/tutorials/cpl...-Functions.php
It does not mention "function variable" anywhere. Can you elaborate?
Code:#include <stdio.h> void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){ puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9 /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i] ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][ t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}
Correct.
no members variables inside struct
yes anywhere local variables
Kuphryn