C++ Lookup of i changed for ISO

前端 未结 3 1334
我寻月下人不归
我寻月下人不归 2021-01-25 00:42

I have the following code for a dictionary.

void Dictionary::translate(char out_s[], const char s[])
{

for (int i=0;i

        
3条回答
  •  滥情空心
    2021-01-25 01:11

    When you do e.g.

    for (int i=0;i

    then the variable i is local to the loop only, you can't really use it outside the loop.

    If you want to use i outside the loop, then you need to declare it outside the loop:

    int i;
    for (i=0;i

提交回复
热议问题