20
Is there a way to only print part of a string?
For example, if I have
char *str = "hello there";
Is there a way to just print "hello", keeping in mind that the substring I want to print is variable length, not always 5 chars?
I know that I could use a for loop and putchar or that I could copy the array and then add a null-terminator but I'm wondering if there's a more elegant way?