什么是使用在C%N格式说明吗? [英] What is the use of the %n format specifier in C?

查看:94
本文介绍了什么是使用在C%N格式说明吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是使用了%N 格式用C说明的?任何人都可以用一个例子解释一下吗?

What is the use of the %n format specifier in C? Could anyone explain with an example?

推荐答案

没有打印。该参数必须是一个指向一个符号整数,其中存储到目前为止写的字符数。

Nothing printed. The argument must be a pointer to a signed int, where the number of characters written so far is stored.

#include <stdio.h>

int main()
{
  int val;

  printf("blah %n blah\n", &val);

  printf("val = %d\n", val);

  return 0;

}

在previous code打印:

The previous code prints:

blah  blah
val = 5

这篇关于什么是使用在C%N格式说明吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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