#include<stdio.h> hi() { printf("hello world! "); } int main() { hi(); int i = hi(); printf("%d ", i); /* 没有void的时候默认返回值为int, 结果i = 13 ???!!!??!?!?! */ }
code 2:
#include<stdio.h> int result(int x) { result = x * x; // c语言不支持这种写法哦~,改为return(x * x); } int main() { int x = 4; printf("%d ", result(x)); }