This is a forum for PHP not C.
That said, a parse error is something that happens when the compiler has a problem with the syntax. these lines are suspect:
15: sum= integer_add( 5, 12 )
16: printf( "the addition of 5 and 12 is %d.\n", sum)
17:return o;
you should add a semicolon ';' after lines 15 and 16. Also, why are you returning the character 'o' at the end of main()?
I'm assuming this is just a test program, so I won't mention that integer_add() is unnecessary.
In integer_add() i would change it to:
int integer_add( int x, int y )
{
return x + y;
}
which will get rid of any unnecessary vars.
good luck!
p.
Christopher Rosario wrote:
I am 17 and am just starting to learn the C programing language and I am very aggrivated because the book that I have doesnt explain what a Parse error is! The code is:
1:/03L02.c: Calculate an addition and print out the result/
2:#include <stdio.h>
3:/ This function adds two integers and returns the result /
4:int integer_add( int x, int y )
5:{
6: int result;
7: result = x + y;
8: return result;
9:}
10:
11:int main()
12:{
13: int sum;
14:
15: sum= integer_add( 5, 12 )
16: printf( "the addition of 5 and 12 is %d.\n", sum)
17:return o;
18:}
I am always getting a Parse error on return. I don't know which one but the book isn't helping so if anyone knows please e-mail me at kokoru84@hotmail.com.
Thankyou.