C99 mode (error)

on this line of code: [code]for (int datasize = 1; datasize <= arraySize; datasize = datasize + 1)[/code]


i get this error: naivesort.c `for' loop initial declaration used outside C99 mode

Comments

  • [b][red]This message was edited by Lundin at 2006-11-7 0:14:39[/red][/b][hr]
    : on this line of code: [code]for (int datasize = 1; datasize <= arraySize; datasize = datasize + 1)[/code]
    :
    :
    : i get this error: naivesort.c `for' loop initial declaration used outside C99 mode
    :


    You can't declare variables inside the for() loop in C. Either move int datasize or compile as C++.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion