I got the following error message while compiling the C code:
error: \'for\' loop initial declarations are only allowed in C99 mode note: use option -std=c9
It means you can't declare variables in for statement.
for
You should do:
int i ; for( i = 0 ; i < len ; i++ )
What you are probably doing
for( int i = 0 ; i < len ; i++ )