In general, we define a constant using # define, #define的本质是文本替换, for example, # define INT_PTR int*, when we use a int_ptr,int_ptr a, B, which is equivalent to an INT * A, A, a, b; That is, define a pointer variable A and integer variable B, which
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 "
Note: Define cannot be defined in a class, and the const must be defined in a class, and the const must be accessed by the class name:: Variable name
1. Const is used for class member variable definition once defined and cannot change its value.
The use of a typedef
In C/s + + language, a typedef is commonly used to define an identifier and a keyword alias, which is part of the language compilation process, but it does not actually allocate memory space, as in the case of:
typedef int INT;
1. Define a simple constant: Define a constant to facilitate modification. (do not add a semicolon to the end !)
# Define n 1000
It is equivalent to const int n = 1000, but slightly different. Define is a simple replacement instead of a quantity.
2
1. Simple define Definition# Define maxtime1000A simple maxtime is defined. It represents 1000. If you writeIf (I The compiler replaces maxtime with 1000 before processing this code.This definition looks similar to a normal constant definition const,
Original article address:
Http://blog.csdn.net/kindazrael/article/details/8108868
Objective-C: # define Usage Analysis
In C, Preprocessor is a powerful tool that makes your code easier to read and modify. With preprocessing code, you can redefine a
Original article address:
Http://blog.csdn.net/kindazrael/article/details/8108868
In C, Preprocessor is a powerful tool that makes your code easier to read and modify. With preprocessing code, you can redefine a part of the code to make your code
#define宏定义在C系开发中可以说占有举足轻重的作用. The underlying framework does not have to say, in order to compile optimization and convenience, as well as cross-platform capabilities, macros are heavily used, it can be said that the bottom of development left define
Windows Phone 8.1, how do I customize the pivot head style? Use the pivot control to accomplish this effect.
Looking for a long time online, only found the solution of Windows Phone 8. Finally a great God gave a recruit, I think I need to
in our previous article, we introduced the use of PHP define examples, I believe that we have a certain understanding of define, today we introduce you to the PHP constant define and the difference between const detailed!
A constant is a simple
Difference between typedef and # define ------ [Badboy ],
Typedef and # define are commonly used to define the alias of an identifier and a keyword, but there is a key difference between them.
Typedef is part of the language compilation process;
#
Const and define all define constants in PHP, but what are their specific differences? In fact, very simple const is used for the definition of a class member variable, once defined and cannot change its value. Define defines a global constant that
C # preprocessor directives are never translated into executable code commands, but can affect all aspects of the compilation process, common preprocessor directives have # define, #undef, #if, #elif, #else和 #endif, and so on, the following
# DefineCreate a macro that is an identifier or parameterized identifier associated with the tag string. After defining the macro, the compiler can mark a string to replace each matching item of the identifier in the source file.Syntax
#
Usage of "#" and "#" in macroI. general usageWe use # to convert the macro parameter into a string, and # to combine the two macro parameters.Usage:# Include# IncludeUsing namespace STD;
# Define STR (s) # s# Define cons (a, B) int (A ## e ## B)
Int
A constant is a simple identifier. This value cannot be changed during script execution (in addition to the so-called magic constants, they are not constants). Constants are case sensitive by default. Usually, constant identifiers are always
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.