In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about the differences between signed main and int main in C++. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Preface
See the boss's C++ code, the main function "int main" typed into "signed main", have doubts, then go to consult.
# pragma Gcc optimize (3, "inline", "Ofast"); # includeusing namespace std;#define int long longtypedef long long ll; signed main () {double dentine > > d; printf (".1f", dmax 59535);}
Because the header file states: # define int long long, and then change int main to signed main
The simplest default source for individuals to write code is:
# include#define int long longusing namespace std;signed main () {return 0;}
Notice # define int long long and the main function must return an int value, so you cannot use int main ().
What are we going to do? Signed main is usually used because signed is equivalent to signed int, that is, signed integers, which is no different from int and does not lead to strange CE.
Int is signed int. Int = signed int = signed, just like unsigned = unsigned int
When you are not sure whether the int will explode in the process, you can write this.
The same number of bytes, if you save symbol bits, the range is positive or negative, the number of digits is relatively less than one, and the range of absolute values is small.
Summary:
Header file statement # define int long long to prevent int from exploding
Mainly distinguishes # define ll long longint main () {ll int x; scanf ("% lld", & x);} # define int long longsigned main () {.}
A unique way to define longlong:
# include#define int long longusing namespace std;const int pendant 1e9pm 3int T rep. Mrec [100010] = {1}; signed main () {for (int item1witi)
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.