什么是在scanf函数的2D% [英] what is the %2d in scanf

查看:272
本文介绍了什么是在scanf函数的2D%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这句话的结果的含义scanf函数(%d个,&安培; X); //读取的变量x一个整数,并将其存储结果
但什么是该做的语句搜索 scanf函数(%2D,&安培; X); 结果
我试图寻找这一点,但无法找到答案。我想知道啥子内部也发生了。

I know the meaning of this statement
scanf("%d",&x); //Reads an integer and stores it in the variable x
But what does this statement do
scanf("%2d",&x);
I tried searching for this, but could not find an answer. I want to know waht happens internally also.

推荐答案

这是两位数字编号:

int n = 0;
scanf ("%2d", &n);
printf ("-> %d\n", n);

12
- > 12

12 -> 12

88657
- > 88

88657 -> 88

这篇关于什么是在scanf函数的2D%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆