user1438389
user1438389

Reputation: 1

Expression result unused objective-c

I am about as nooby to this as it gets. Can someone please tell me how to fix this?

#include <stdio.h>

int main(int argc, const char * argv[])
{    
    int sum;   
    sum = 50 + 25;
    "The sum of 50 and 25 is %i", sum ;

    return 0;
}

Upvotes: 0

Views: 1017

Answers (2)

Michael Dautermann
Michael Dautermann

Reputation: 89509

Change the line:

"The sum of 50 and 25 is %i", sum ;

to:

printf( "The sum of 50 and 25 is %i", sum );

The line in quotes by itself is a syntax error that just happens to be getting by the compiler (which is apparently throwing a warning instead).

Upvotes: 3

Morion
Morion

Reputation: 10860

You have this warning because of not using your sum value. To print it use NSLog

Upvotes: 0

Related Questions