C++ Tips:signed main 和 int main 的区别?
#include<bits/stdc++.h> #define int long long using namespace std; signed main(){ return 0; }
注意到 #define int long long 而 main 函数必须返回一个 int 值,所以不能使用 int main()
通常使用 signed main,因为 signed 等效替代于 signed int,也就是有符号整型,这与 int 别无二致,但不会导致超出范围
c++ - Difference between signed main() and int main()? - Stack Overflow:
int main
doesn't return -signed main returns . You have defined a macro named .int
long long
int
Speaking of which, defining a macro with the name that matches a keyword exhibits undefined behavior.
hello my world
本文来自博客园,作者:slowlydance2me,转载请注明原文链接:https://www.cnblogs.com/slowlydance2me/p/16909205.html