I have an array:
char arr="This is the string";
- is a printf formater for justification, not precision.
What you want is the
. formater which is used for precision :
This will print the first 5 elements of
If you want to learn more about printf formaters, take a look at this link.