开发者

How to represent this in printf format?

I have:

printf("%.2s\n", &s[2]);

How can I represent that as a chosen value?

So I would want something like:

printf(%.%is\n",开发者_JAVA技巧 someInt, &s[2]); # but this doesnt work, where %i is someInt


You want printf("%.*s\n", someInt, &s[2]);. Consult the printf man page for more details.


I am confused about your question but I think you want printf("%d.%s\n",someint,&s[2]);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜