In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article Xiaobian for you to introduce in detail "what is the difference between const and define in C language", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what is the difference between const and define in C language" can help you solve your doubts.
Define and const use
The difference between const and define
# include # define A 1#define B (Aq3) / / # define C A/B*3 / const cannot be redefined and two cannot be defined the same. Define cancels the definition of a symbol through undef, and then redefines const double PI=3.14;//const double PI=3.145 # define PI2 3.14#undef PI2 / / cancel the definition of PI2 # define PI2 3.145void main () {/ Analytical process / define is a simple replacement! / / C is actually A/A+3*3 = 1 A/A+3*3 1 + 3 # = 1 + 9 = 10 / / C is actually A / (Aq3) * 3 = 1 / (1 * 3) * 3 = 1 * 3 =? Double D1 = 1.0 nc=%.2f 4 * 3; / / 0.25 * 3 = 0.75 printf ("\ nc=%.2f", C); / / ask c =? Printf ("\ nd1=%.2f", D1); getchar ();} # include / / # define DEBUGvoid main () {# ifdef DEBUG / / if DEBUF printf ("ok, debug information") is defined; # endif#ifndef DEBUG / / if no DEBUF printf is defined ("hello, additional information"); # endif// printf ("% d", n) Getchar ();} read here, this article "what is the difference between const and define in C language" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it before you can understand it. If you want to know more related articles, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.