In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "how to use global variables in c language", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article, let's take a look at this "how to use global variables in c language" article.
1. All variables defined outside the function are called global variables, and their default functional domains are valid from the location of the defined variable to the end of the source file.
2. If you need to use global variables, it is best to define them at the top of the file, so that all functions in the file can be used directly.
Example
# include void func1 () {x + = 10; y + = 20; printf ("function:% s x =% d y =% d\ n", _ _ FUNCTION__,x,y);} int x = 10 × int y = 20; void func2 () {x + = 10; y + = 20; printf ("function:% s x =% d y =% d\ n", _ _ FUNCTION__,x,y) } int main () {func1 (); func2 (); printf ("function:% s x =% d y =% d\ n", _ _ FUNCTION__,x,y); return 0;} / * output: main.cpp: In function 'void func1 ()': main.cpp:6:5: error:'x 'was not declared in this scope 6 | x + = 10 | | ^ main.cpp:7:2: error:'y' was not declared in this scope 7 | y + = 20; | ^ * / above is about the article "how to use global variables in c language". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about it, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.