print不是函数

对文章阅读有感!!!
文章地址:http://www.laruence.com/2019/03/01/4904.html

print是一个语法结构(language constructs), 他并不是一个函数。

if (print("1\n") && print("2\n") && print("3\n") && print("4\n")) {
    ;
} 
//输出4111而不是1234,想要输出1234,得这么写:

if ((print "1\n") && (print "2\n") && (print "3\n") && (print "4\n")) {
    ;
}

如何理解这个:
print里的参数如果是表达式,一律返回1;
遇到运算符,在编写代码的时候一律要在运算符两边主动加上括号“()”,不然一不小心就犯错。

猜你喜欢

转载自www.cnblogs.com/xinxinmifan/p/print.html