小编San*_*a S的帖子

函数没有在C中指定的返回类型

我在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)

我想知道函数"修井"的声明是如何有效的?当我们没有提到函数的返回类型时会发生什么?(我们可以返回任何内容吗?).参数也只是一个变量名,这是如何工作的?

c function-declaration

5
推荐指数
1
解决办法
1万
查看次数

引号内的报价

在Python 3.x中:

    print(""s"")       # SyntaxError
    print("""s""")     # prints s
    print(""""s"""")   # SyntaxError
    print("""""s""""") # prints ""s
Run Code Online (Sandbox Code Playgroud)

当字符串中有不同数量的双引号时,这种不同行为背后的原因是什么?

python string python-3.x double-quotes

2
推荐指数
1
解决办法
184
查看次数

函数调用作为参数在python 3.x中打印

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,即使在函数调用之后?

python function-call python-3.x

2
推荐指数
1
解决办法
55
查看次数