--- Quote Start ---
for(int i=1;i<height-1;i++){
for(int j=1;j<width-1;j++)
--- Quote End ---
You can't define variables inside the for loop instruction.
This mode is not supported by Nios C compiler.
Declare i and j with other variables.
--- Quote Start ---
int **IM ,**im1;
--- Quote End ---
IMHO this declaration is ambiguous if you then use these pointers to address a bidimensional array.
You don't specify dimensions, so, how can compiler know how to map array indexes to memory?
--- Quote Start ---
IM[i][j]=r
--- Quote End ---
Semicolon missing
Regards
Cris