cool hit counter Basic C Language Syntax 1_Intefrankly

Basic C Language Syntax 1

Before learning C, understand its execution and some basic elements and syntax. Remember some basic syntax in order to achieve a one-step compile-through.

Execution of C programs: Writing a piece of C code and turning it into an executable program is as simple as clicking a compile button, but it's not that simple inside the computer. It first goes through a preprocessor, which hands the program to the preprocessor, executes instructions beginning with # and adds certain content to the program; after that it goes to the compiler, which translates the program into the target code; and finally the linker integrates the target code with the rest of the code needed to finally produce a fully executable program.

command : Commands executed by the preprocessor, all instructions start with # and each instruction ends without a semicolon or other special marker.

statement : A command that is executed when the program is run. To indicate the end of a statement, mark the end of each line with a semicolon. Exceptionally, compound statements do not use semicolon endings; instructions usually occupy only one line and do not need to be terminated with a semicolon.

line break : The printf function in C does not automatically jump to the next output line, and to achieve this, a line break is usually added to the double quotes , the line break is not the same as the carriage return key, which must be noted.

add comments to text : C has two comment methods, one starting with /* and ending with */, which allows for single- or multi-line comments, and the // method, which allows for single-line comments only. Notes may not be applied. Comments are not discarded outright in C compilation, but are treated as a space no matter how long the comment is.

statement : One of the more complex aspects of C compared to Python is that the type declaration is done by estimating the broad scope of a variable before it is used.

macro definition : Similar to the format of the directive, it is quoted with # at the beginning, in the following format.

# Constant name Value

Usually capital letters are used for constant names; when there are operators in the value, they must be enclosed in parentheses. Macro definitions can also be defined in a simple function-like manner, which is only briefly described at this stage.

identifier : consists of letters, numbers, and slashes, and cannot begin with a number; try not to begin with a slash, although slashes are legal, but certain keywords beginning with an underscore that have not yet been added are pre-preserved in C.

Type control in assignment: If you want to assign a value of type float to a variable, add an f to the end of the value, which indicates that the value is of type float, otherwise it is automatically raised to type double. Although type double is more precise than float, it runs, it takes up more space in memory, and is slower than float. Although this time is negligible, it cannot be ignored, and the pain is really indescribable if you have a runtimeout in a later oj question.

Disclaimer: The above content is a compilation and sharing of knowledge that I feel is important in the learning process as a white person. If there are any errors, please contact the editor for prompt correction. Contributions are welcome and will be followed by mainly algorithmic knowledge as the editorial skills improve.

1、InterviewNokia Chief Scientist Lixin Fan Explainable Deep Neural Networks with Fuzzy Logic
2、linux memory Discussion of the maximum memory usage of a process
3、Introduction to MySQLBinlog
4、Academia All videos and courseware for MIT deep learning course open
5、ECCV2018Kuangwei Technology proposes a new lightweight architecture ShuffleNetV2 from theoretical complexity to practical design guidelines

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送