I want to do the following, taking into account a string as how are you I want to print from a until e ie the word are. I tried this
char str[] = "how are you";
printf("%*.*s\n", 5, 8, str);
Output
how are
Expected output
are
Someone has idea how this can be done?
The characters in the string are indexed from 0, so the
ais at index 4. By passing&str[4]to printf, the printf will start at thea, and print as many characters as specified by the precision.