C语言scanf返回什么,函数scanf返回的是什么呢?

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

_CRTIMP int __cdecl scanf(const char *, ...);

这个是原stdio.h包里面的内容.

下面看这代码说明:

C++ Language Reference

__cdeclSee Also

Argument Passing and Naming Conventions | C++ Keywords

Microsoft Specific

This is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do vararg functions. The __cdecl calling convention creates larger executables than __stdcall, because it requires each function call to include stack cleanup code. The following list shows the implementation of this calling convention.

Element Implementation

Argument-passing order Right to left

Stack-maintenance responsibility Calling function pops the arguments from the stack

Name-decoration convention Underscore character (_) is prefixed to names

Case-translation convention No case translation performed

Note For related information, see Decorated Names.

Place the __cdecl modifier before a variable or a function name. Because the C naming and calling conventions are the default, the only time you need to use __cdecl is when you have specified the /Gz (stdcall) or /Gr (fastcall) compiler option. The /Gd compiler option forces the __cdecl calling convention.

Example

In the following example, the compiler is instructed to use C naming and calling conventions for the system function:

// Example of the __cdecl keyword on function

_CRTIMP int __cdecl system(const char *);

// Example of the __cdecl keyword on function pointer

typedef BOOL (__cdecl *funcname_ptr)(void * arg1, const char * arg2, DWORD flags, ...);

END Microsoft Specific

See Also

Argument Passing and Naming Conventions | C++ Keywords

得出结果:

__cdecl 调用约定

int表示返回类型

那么scanf的返回类型就是int�

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值