c - Print from one position to another - using printf -


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

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -