0

I am getting an expression result unused error when working on the credit program. My code is as follows:

for (i = 1, i <= length, i = i+2)
{ 
    a = num / (pow (10,(i-1))) - 10 * num / (pow(10,i)) ;
    printf ("%i\n",a) ;

length is calculated as an integer earlier in the program. Can anyone tell me what's wrong here?

1
  • the code you post is insufficient to respond, may initialize a variable that you do not use throughout the program, or you use a function that should return a value but it does not
    – MARS
    Commented Jun 19, 2016 at 20:36

1 Answer 1

2

Punctuation. Review this line for (i = 1, i <= length, i = i+2). Are you also getting this error: error: expected ';' in 'for' statement specifier ? That is not correct for syntax.

1
  • Thanks, I realized this after watching week 2 this morning, sometimes you can't see what's staring you in the face! Was using commas not semi colons. Commented Jun 20, 2016 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .