function - C++ Lookup of i changed for ISO -


i have following code dictionary.

void dictionary::translate(char out_s[], const char s[]) {  (int i=0;i<numentries;i++) {    if (strcmp(englishword[i], s)==0)        break; } if (i<numentries) strcpy(out_s, elvishword[i]); 

which gives me error name lookup of changed iso , mentions code accepted if use -fpermissive. if try , initialize variable outside loop generates whole load of errors.

any ideas?

thanks in advance.

not "for iso" (perhaps read entire error message...), iso c++. problem scope of i variable for loop (since definition inside initialization of loop). since seems want use outside loop, declare so:

int i; (i = 0; < foo; i++) {     // ... }  do_safe_stuff_with(i); // valid 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -