我在C中遇到了这段代码:
#include <stdio.h>
main( )
{
int i = 5;
workover(i);
printf("%d",i);
}
workover(i)
int i;
{
i = i*i;
return(i);
}
Run Code Online (Sandbox Code Playgroud)
我想知道函数"修井"的声明是如何有效的?当我们没有提到函数的返回类型时会发生什么?(我们可以返回任何内容吗?).参数也只是一个变量名,这是如何工作的?
在Python 3.x中:
print(""s"") # SyntaxError
print("""s""") # prints s
print(""""s"""") # SyntaxError
print("""""s""""") # prints ""s
Run Code Online (Sandbox Code Playgroud)
当字符串中有不同数量的双引号时,这种不同行为背后的原因是什么?
a = 0
def f():
global a
a = 1
print(a)
print(a, f(), a)
Run Code Online (Sandbox Code Playgroud)
上述代码的输出结果如下:
1
0 None 1
Run Code Online (Sandbox Code Playgroud)
为什么f在打印第一个参数之前调用函数a?为什么是第一个参数的值0,即使在函数调用之后?