Discover difference between const and define, include the articles, news, trends, analysis and practical advice about difference between const and define on alibabacloud.com
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 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
The difference between "constant" and "read-only variable". Constants are definitely read-only , such as 5, "ABC", and so on, which is definitely read-only, because constants are read-only areas that are placed in memory by the compiler, and
In PHP define () and const () can define constants, then the difference between define () and const exactly where, this many programmers do not understand, I would like to introduce to you some of this function usage ratio.
The difference between
: This article mainly introduces the difference between const and define in php (supplement). If you are interested in PHP tutorials, refer to it. A constant is the identifier (name) of a simple value ). As its name implies, this value cannot be
A constant is an identifier (first name) of a simple value. As the name implies, the value cannot be changed during script execution (except for the so-called magic constants, they are not constants). Changshime is considered to be case sensitive.
Yesterday interview by the Group of Examiners asked about the const and define similarities and differences, began to be simple, then asked my head is a group of paste. Almost a summary of the information today1. Const and define.Both can be used to
Difference between const and # define,
(1) Different compiler Processing MethodsThe define macro is expanded in the preprocessing phase.
Const constants are used in the compilation and running phase.
(2) Different Types and security checks
The
The difference between define () and const in php is described in detail. In php, both define () and const () can define constants. So what is the difference between define () and const? many programmers do not understand this, next I will introduce
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
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.