getchar()和scanf("%c")的功能都是从STDIN读一个字符,单论功能两者没有区别. 但两者的返回值是有区别的: ------------------------------------------------ scanf()的详尽介绍请移步这里. ------------------------------------------------- scanf()的返回值的含义是: On success, the function returns the number of
一个.scanf功能介绍 这也是在stdio.h中声明的一个函数.因此使用前必须增加#include<stdio.h>. 调用scanf函数时,须要传入变量的地址作为參数,scanf函数会等待标准输入设备(比方键盘)输入数据,而且将输入的数据赋值给地址相应的变量. 函数原型为:int scanf(const char*format,...); 二.scanf使用方法 #import <stdio.h> int main() { int age