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]);
精彩评论