c语言 - 想知道为什么我会收到错误"use of an undeclared identifier"


// TODO: Calculate number of years until we reach threshold
{ 
int years;
while (ending_size>=starting_size)
starting_size = starting_size + (starting_size/3) - (starting_size/4);
years++;
}
{// TODO: Print number of years
printf("Years: %in", years);
}
}

当我运行我的代码时,它会说";使用未声明的标识符";年";,我想这可能是由于我格式化代码的方式。感谢

看起来在声明年份的代码周围有{}。我认为这是你的问题。{}限制了它的范围。

相关内容

最新更新