Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] lang/var #2579

Closed
1 task
ksyx opened this issue Aug 20, 2020 · 0 comments · Fixed by #2590
Closed
1 task

[BUG] lang/var #2579

ksyx opened this issue Aug 20, 2020 · 0 comments · Fixed by #2590
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed

Comments

@ksyx
Copy link
Member

ksyx commented Aug 20, 2020

  • 我正在着手修复这个问题

我正在访问这个页面(最好带链接)

https://oi-wiki.org/lang/var/

我发现页面有这样的问题

  • 声明变量 中:
    • 声明和定义不分。
    • 在目前我们所接触到的程序段中,声明在花括号包裹的地方的变量是局部变量,而声明在没有花括号包裹的地方的变量是全局变量。实际有例外,但是现在不必了解。(见下方)
  • 变量作用域 中“全局变量的作用域是整个文件,全局变量一旦声明,在整个程序中都是可用的。”:
    • 全局变量的作用域是整个文件(include 呢)
    • 在整个程序中都是可用的
#include<cstdio>
int funcb(){
        printf("%d\n",a);
}
int a;
int main(){
        return 0;
}
3:16: error: ‘a’ was not declared in this scope
  printf("%d\n",a);
@ksyx ksyx added Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed labels Aug 20, 2020
StudyingFather added a commit that referenced this issue Aug 24, 2020
Early0v0 added a commit that referenced this issue Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant