when you declare a prototype, like in line 4, you declare the function type, function name, and argument types, like you did: [icode]void printtable(int x);[/icode], this must match the definition of the function, which you have down on line 46.
but when you *call* the function in the program, like … Read More

gerard4143
Its a C++ compiler, #include<iostream> is automatically in the code..Could take it out but it works either way.. using namespace std; is a typo..it wasnt in the code when i compiled it.. think i have the rite amount of braces for the function definition: 2 open and 2 closed, then the final brace to close main..also it doesnt matter what name i give function im still getin this error

Jephthah
sorry for initial code layout ive cleared it up..First time using site..Yes print and printtable were same function sorry for that typo..ive reposted code using the latter..The reason im using a dedicated function just for this is because Im starting off and do not know how to call functions => thought id just keep it simple and see if i could actually get the method right..I did not know that once you listed the parameter types in the definition that u didnt have to declare them locally in the function, thanks for clearing that up with me.

Thomas
Thanks..I thought the main() braces had to enclose everything..Moved them like you said and its compiling fine now..Problem is though im not getting any output from the printtable function.. im calling it within main but the only output im getting is from the Initial Permutation loop..Can anyone help me out here please??

when you declare a prototype, like in line 4, you declare the function type, function name, and argument types, like you did: void printtable(int x); , this must match the definition of the function, which you have down on line 46.

but when you *call* the function in the program, like at line 9, do not include the function type or argument types, so you just call it like so: printtable(10); .... where the number "10" (for example) could be any "int" value and will be passed to the function.

you see that whatever value passed in from the function call (line 9) will come into this function via the argument as "int x"... the purpose of this would be to have a value that could then be used for whatever purpose you intended within the function.

HOWEVER, what you are doing is not really correct, or at least is not what is intended. once you get to the function, you reassign "x=0" in your FOR loop, thereby losing whatever value was passed in.

it seems to me that you really intend to have "x" be the upper limit of your for loop, so that it counts out "x" numbers. change your printtable function to something like this:

now when you call from line #9, you can pass any argument and that will be the number used by the function. otherwise, if you're just hardcoding x=10 in the function, you might as well delete the "int x" from the function argument and replace it with "void", and then there would really no point in having the function for such a trivial operation.