当前位置:网站首页>Some knowledge of the initial C language

Some knowledge of the initial C language

2022-06-25 13:20:00 LIn_ jt

Preface

I'm learning c Language , We will be right. c Make a general understanding of each classification knowledge of language , This paper will introduce several classification knowledge ( Follow up will continue to supplement )

Text

  One . first c Language program , Please look at the chart below.

Here main Function is the entry of the program , There is and only one in a project main function .

And the first 6 Yes printf The function is a print function , That is, output... On the screen “   ” Content between , The result of the program is :

Two . data type

    1. Data types are used to define variables ,c The language mainly provides the following data types :

2. The space occupied by each data type

  Look at the following procedure

  Here sizeof keyword , It means to calculate the memory occupied by an object , Unit is byte, The following are the output results

 1 2 4 4 8 4 8 In the order shown above ) That is, the memory size occupied by each data type .

3、 ... and . Variables and constants

1. Variable

Variables are literally variable quantities , The method of defining variables is shown in the figure below :

 ( It is recommended to assign initial values to variables when creating them .)

2. Classification of variables

There are two kinds of variables , One is local variable , One is Global variables .

For local variables : Is defined in braces ( Code block ) The variables in are local variables .

For global variables : Variables defined outside braces are global variables , Please look at the chart below. :

 by the way When the variable names of local variables and global variables are the same , Local variables take precedence :

example :

The above is the initial c Part of the knowledge of language , Subsequent updates will continue ! 

 

原网站

版权声明
本文为[LIn_ jt]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251235204699.html