c - Print from one position to another - using printf -
this question has answer here:
i want following, taking account string how you want print a until e ie word are. tried this
char str[] = "how you"; printf("%*.*s\n", 5, 8, str);
output
how
expected output
are
someone has idea how can done?
the characters in string indexed 0, a
@ index 4. passing &str[4]
printf, printf start @ a
, , print many characters specified precision.
printf("%.*s\n", 3, &str[4]);
Comments
Post a Comment