1

I am trying to compile this simple program on Xcode 5 and I'm getting a "thread 1: breakpoint 1.1" message at error line below. Anyone know how I can fix it?

Here's my code:

#import <Foundation/Foundation.h>

int totalSavings(int listTotal);

int main(int argc, const char * argv[])
{
    @autoreleasepool {

        int itemEntry, itemEntry1, itemEntry2,
        listTotal, calcSavings;

        itemEntry = 320;
        itemEntry1 = 218;
        itemEntry2 = 59;
        listTotal = itemEntry + itemEntry1 + itemEntry2;
        calcSavings = totalSavings(listTotal);          \\error line
        NSLog(@"Total Planned Spending: %d \n Amount Saved: %d", listTotal,
        calcSavings);             
        }
    return 0;
}

int totalSavings(int listTotal)

{
    int savingsTotal;
    savingsTotal = 700 - listTotal;
    return savingsTotal;
}

1 Answers1

1

Including the type int in the call is incorrect syntax.

The line in error:

calcSavings = totalSavings(int listTotal);

The fixed line:

calcSavings = totalSavings(listTotal);

The error message is:

Untitled.m:16:36: error: expected expression  
        calcSavings = totalSavings(int listTotal);          // error line  
                                   ^  

Notice the "^" just under int, this is a clear indication of where the error is.

zaph
  • 111,848
  • 21
  • 189
  • 228