[英]Wondering why I'm getting the error “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: %i\n", years);
}
}
當我運行我的代碼時,它說“使用未聲明的標識符“年”,我認為這可能是由於我格式化代碼的方式。謝謝
看起來您在聲明年份的代碼周圍有{
... }
。 我認為這是你的問題。 {
和}
限制了它的 scope。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.