六六互联

计算机格式化输入函数—scanf

break-word; clear: both; text-indent: 2em; color: rgb(24, 30, 51); font-family: PingFangSC, 微软雅黑, 黑体, Arial, Helvetica, sans-serif; font-size: 18px; background-color: rgb(255, 255, 255); line-height: 2;">scanf 函数称为格式输入函数,即按用户指定的格式从键盘上把数据输入到指定的变量之中。 

break-word; clear: both; text-indent: 2em; color: rgb(24, 30, 51); font-family: PingFangSC, 微软雅黑, 黑体, Arial, Helvetica, sans-serif; font-size: 18px; background-color: rgb(255, 255, 255); line-height: 2;">1.  scanf 函数的一般形式 

scanf 函数是一个标准库函数,它的函数原型在头文件“stdio.h”中,与 printf 函数相同,C语言也允许在使用 scanf 函数之前不必包含 stdio.h 文件。 

计算机格式化输入函数—scanf

scanf 函数的一般形式为: 

    scanf(“格式控制字符串”,地址表列); 


其中,格式控制字符串的作用与 printf 函数相同,但不能显示非格式字符串,也就是不能显示提示字符串。地址表列中给出各变量的地址。地址是由地址运算符“&”后跟变量名组成的。 


相关推荐