This entire chunk makes no sense, what-so-ever:
main() //This is the part returning the error
sum (v)
answer sum() |
What do you think that each line is supposed to do (from what I have quoted)? Maybe if you explain that, we can better help you.
Also:
-In the parameter list for the second sum function, you missed a space between int and n2,
-You are missing a brace at the end of your print function,
-You don't provide a function prototype for your print function,
-In main, you declare a variable named sum. This is an issue because you have a function named sum in the global scope that is "hidden" (if you will) in the main function by the local sum variable.
After fixing the above, I got it to compile and run.
The function sum may need assignment modifiers (ie a=1 not a1, unless you mean to refer to a variable "a1" |
int sum(int a1, int b1)
As you can see, a1 and b1 are parameter names (read: variables).
Also I believe you need return statements, ie return(); or return(0); You could also use return (answer); but I assume you're practicing passing variable references. |
I would assume that the OP understands return statements, as he/ she has properly used them in the first sum function. The second sum function returns void (read: nothing), and has a reference variable answer, so you would be right in saying that the OP is practicing using references.