Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macsrockmysocks

macrumors regular
Original poster
Feb 21, 2006
233
0
I have received my new book on ObjC today and am doing an exercise. Here is the code that I am having errors from:
Code:
#import <stdio.h>

int main(int argc, char *argv[])
{
int sum;
// Compute Result
sum = 25 + 37 - 19
// Display Results
printf ("The answer is %i\n", sum);

return 0;

}

It says there is a problem with my printf line, but I don't see it. Do any of you?
 

macsrockmysocks

macrumors regular
Original poster
Feb 21, 2006
233
0
I cannot believe I missed that. I am so stupid! Oh well, you learn from mistakes. Now, I am off to Chapter 3- Objects.
 

mduser63

macrumors 68040
Nov 9, 2004
3,042
31
Salt Lake City, UT
exabytes18 said:
I don't program in obj-c, and don't know if this is a typo, but try adding a semicolon to make "sum = 25 + 37 - 19;"


That is most likely the problem. One thing you should learn is that often when the compiler complains about a particular line, it is often the line above it that's the real problem.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.