PROBLEM PASSING ARRAY TO A FUNCTION

Feb 13, 2009 at 4:27pm
I get the following error when i try to pass an array (of char type) to a function
'UNDEFINED SYMBOL (NEAR*,INT) IN MODULE filename.CPP' function definition is 'SHIFT(CHAR XS,INT LEN)' im trying to pass an array containing characters inputed using gets. len contains the length of the array.
the function declaration is 'CHAR SHIFT(CHAR XS,INT LEN)' please help, im a beginner in programing
Feb 13, 2009 at 5:08pm
It's all upper case?
1
2
3
CHAR SHIFT(CHAR XS,INT LEN){
//...
}
Feb 13, 2009 at 5:17pm
closed account (S6k9GNh0)
Would you please post your code and your errors...
Feb 13, 2009 at 9:22pm
If you want to paste your code put it all between this for example:

[code] //paste all of your code between these two box brackets [/code]
Feb 14, 2009 at 2:32am
In the parameters you have to put empty square brackets to indicate an array. Try this:
1
2
3
char SHIFT(char XS[], int LEN){
...
}
Feb 14, 2009 at 5:58am
Square brackets are not needed (c++ knows it is an array)... I believe (please correct me if I'm wrong), they are just a notation for the programmer.
Last edited on Feb 14, 2009 at 5:59am
Feb 14, 2009 at 11:29am
eker676: Please refrain from posting anymore. You do not have enough experience with C++ to help others, and for each time you post, it's likely someone else will have to post to correct you.
Feb 15, 2009 at 4:18am
^ .. :P /snap
Feb 16, 2009 at 1:50am
char SHIFT(char XS[value], int LEN[value])

{

}

value = 1,2,3,...
Feb 16, 2009 at 5:05am
Square brackets are necessary for the declaration, so it knows to accept an array, not for the actual passing.

@OP: Please post up your code so we can help.

If I had to take a guess though, I'd say the lack of a space after the comma might be the problem.

(CHAR XS,INT LEN)

should be

(CHAR XS, INT LEN)
Feb 16, 2009 at 5:25am
@Garandy: Dude, there is no problem with comma thing. @Matt23488's code is correct.
Feb 16, 2009 at 6:21am
I wasn't pointing to Matt's code, I was pointing to the OP's. Matt's header looks just fine.
Topic archived. No new replies allowed.