In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "how to declare functions in c language". The editor shows you the operation process through actual cases, and the operation method is simple, fast and practical. I hope this article "how to declare functions in c language" can help you solve the problem.
Declaration of function
The function call in C language is defined first and then used, that is, the called function is defined before the main tone function.
If you need to define the tuned function after the tone function when you customize the function in the program, you need to add the function prototype declaration before the function call. If there is neither a function definition nor a function declaration before the function call, there will be an error at compile time.
The general form of a function prototype declaration:
Type descriptor function name (list of formal parameter declarations)
Example: define a function to calculate the area of a circle, enter the radius in the main function and calculate the area.
Reference Code:
1 # include
2 # define PI 3.14159
3 int main ()
4 {
5 / / function prototype declaration
6 double circle (double radius)
7 double r, area
8 scanf (&% lf)
9 area = circle (r)
10printf ("area=%.2f\ n", area)
11 return 0
12}
13 double circle (double radius)
14 {
fifteen
16 return PI * radius * radius
17}
Only the type of formal parameter can be given in parentheses after the function name in the function declaration, and the name of the formal parameter can be omitted. For example, the function declaration on line 5 in this example can be written as follows:
Double circle (double); if a function declaration is made at the beginning of the source program file before all function definitions, then all functions in the source program file can call the declared function.
This is the end of the introduction to "how to declare functions in c language". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.