If you want to output a specified number of chars from a char array using a printf-like function, you can use:
char buffer = “Hi there!”;
int n = 2;
printf(“%.*s”, n, buffer); // outputs “Hi”
It will output only the first n number of characters form buffer.