Let's look at a few examples
(1) struct{int x; int y;} Test1;
Well, define the structure test1,
test1.x and test1.y can be used in the statement.
(2) struct test {int x; int y;} Test1;
Well, define the structure test1,
test1.x and test1.y can be
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;
Codeforces Round #313 (Div. 2) E. Gerald and Giant Chess theorem Lucas calculates the big composite number,E. Gerald and Giant Chesstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
Giant chess is
Usage and difference between typedef and # define
I. Usage of typedef
In C/C ++, typedef is often used to define an alias for an identifier and a keyword. It is part of the language compilation process, but it does not actually allocate memory
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 "
Recently, the serverphp version number has been upgraded to 5.6 and a lot of warnings have been found.Preg_replace (): the/e modifier is deprecated, use preg_replace_callback insteadDidn't notice at the beginning. Later found that a lot of such
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
Transferred from: http://www.cnblogs.com/kerwinshaw/archive/2009/02/02/1382428.htmlI. Usage of typedefA typedef is commonly used to define an identifier and an alias for a keyword in the C + + language, which is part of the language compilation
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;
#
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.