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

What are the key words of C language?

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the relevant knowledge of "what are the keywords of C language". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

As early as C90, that is, the first version of ISO C language, contains a total of 32 keywords, these keywords in the vast majority of C language books will explain, but also we usually use a high frequency of some keywords. As shown in figure 1.

Figure 1 keywords in C89/C90

Later, when C99 updated the standard, the keywords in C90 were expanded, and the number of keywords in this expansion was 5, covering the expansion of data types, function definition, pointer definition and so on. The five new keywords for C99 are shown in figure 2.

Figure 2 five new keywords added to C99

The _ Complex and _ Imaginary keywords add plural support in C, including the standard header "", we can use complex to represent _ Complex, imaginary to represent _ Imaginary, and "_ Complex_I" or capital "I" to represent the imaginary unit I, that is, the square root of-1. The _ Bool keyword complements C's support for Boolean types. After including standard header files, we can use bool instead of _ Bool, true instead of 1, and false instead of 0. For example: bool logic_switch = true;logic_switch = false; there are no Boolean keywords in the C language we mentioned earlier, which is also based on what C90 said, because the Bool type keywords added after C99 are not similar to the native C language keywords in the usual sense and need to be supported by additional header files. The latest C language version, C11, adds seven keywords to C99, as shown in figure 3.

Figure 3 7 keywords added in C11

Among these keywords, _ Alignof gives the number of bytes of memory alignment for the specified data type. For example, if double is aligned by 8 bytes, its memory address is an integer multiple of 8. The _ Alignas keyword specifies that a variable is aligned to other data types. For example, if char is normally aligned by 1 byte, you can specify 2 byte alignment by short type. The _ Atomic keyword is an added keyword for multithreaded atomic operations. The _ Static_assert keyword is used for assertions during compilation, so it is also called static assertion. _ Noreturn indicates that the function does not return the tone function after the call is completed. Note that this is different from the void return type. A function of type void returns the main tone function after execution, but it does not provide a return value. _ Thread_local is the thread storage class qualifier. _ Generic provides a way to select one of several expressions at compile time based on the type of control expression. For the C11 standard, when we do the C language design at ordinary times, we use very little, because for the single-chip microcomputer development, the program design is relatively simple, basically do not use the new functions in C11. For Linux development, the underlying program development is based on GNU C language, and GNU C language has many extensions to the standard C language, and even some new features in C11 are borrowed from GNU C. When we specify that the GCC compiler compiles the C language version, we can use the suffix command-std=c11 to make the compiler support the C11 version. For example:-std=c++11, supports the Category 11 standard;-std=gnu++11, supports the C language 11 standard and GNU extension features; therefore, when we compile, we specify the C language version, you can directly use the command: gcc-o program name source file. C-std=c11. "what are the keywords of the C language" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Internet Technology

Wechat

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

12
Report