[Switch] DEFINE introduction and multi-row macro definition in C language, define multiple lines
[Go] DEFINE introduction and multi-row macro definition in C LanguageTo write a good C language, a beautiful macro definition is very important. Macro
The difference between #define, const, typedef#define is not defining variables, it's just for text substitution.For example:#define PI 3.1415926float Angel;angel=30*pi/180;Then, when the program is compiled, the compiler will first "#define PI 3.141
#define是C语言中提供的宏定义命令, the main purpose is to provide programmers with certain convenience in programming, and to a certain extent, improve the efficiency of the program, but students often do not understand the nature of the command in learning,
Definition:
The # define Directive
You can use the # define directive to give a meaningful name to a constant in your program. The two forms of the syntax are:
Syntax
# Define identifier token-stringopt
# Define identifier [(identifieropt,...,
Macro definition in many languages can see its shadow, C #, C++,c, and so on, especially the system API inside a lot of macro definition, looking very bluffing people. Reasonable use of macro definition, you can make your code look more standardized,
To write a good C language, a beautiful macro definition is very important. Macro definitions can help us prevent errors, improve code portability and readability, and more.In the software development process, there are often common or common
Difference between typedef and define
The following code is used to describe
Typedef char * typedef_char;# Define define_char char * // No semicolon here
Void main (INT argc, char * argv []){Char s [] = "ASDF ";Const typedef_char P = s; // char *
1 NO parameter macro definitionThe macro name of the parameterless macro is not followed by a parameter.The general form of its definition is:#define Identifier stringWhere the "#" indicates that this is a preprocessing command. All that begin with "
Http://blog.sina.com.cn/s/blog_686188ef0100klku.html#define是C语言中提供的宏定义命令, the main purpose is to provide programmers with certain convenience in programming, and to a certain extent, improve the efficiency of the program, but students often do not
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.