Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the two function definition styles of ANSI and Kroomampterterr

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to understand the two function definition styles of ANSI and Kappr. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

In the function definition of C language, we usually use the function definition way of ANSI-C. But when the father of C language founded C language, the definition form of function is not the form we see now. The following code shows the difference, and notice the difference between the declaration and the function body signature.

# include # include / * Krar Standard=start=*/const char* originalFunc (); / * Krar Standard-end-*//*ANSI Standard=start=*/const char* ANSIFunc (char param1, char* param2); / * You also can define the function like below.* const char* ANSIFunc (char, char*) * / / * ANSI Standard-end-*/int main () {printf ("const char* originalFunc (param1,param2):% s\ n", originalFunc ('averse, "word")); printf ("const char* ANSIFunc (param1,param2):% s\ n", ANSIFunc (' averse, "word")); return EXIT_SUCCESS } / * Krar Standard=start=*/const char* originalFunc (param1, param2) char param1;char* param2; {printf ("param1:%c\ nparam2:%s\ n", param1, param2); return "originalFunc" } / * Krar Standard-end-*//*ANSI Standard=start=*/const char* ANSIFunc (char param1, char* param2) {printf ("param1:%c\ nparam2:%s\ n", param1, param2); return "ANSIFunc" } / * ANSI Standard-end-*/

The comparison between the declarator style and the ANSI-C style is also called identifier-list, while the other style is also called declarator, in which originalFunc (param1, param2) is the declarator. In fact, both styles are defined in the ANSI 99 standard (Section 6.9.1), but we prefer the declarator approach. Because it casts the parameter, which is not done in the way of the identifier list.

On how to understand ANSI and Kappr two function definition style to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report