It might be useful to assign a null in a string rather than explicitly making some index the null char '\0'
. I've used this for testing functions that handle strings ensuring they stay within their appropriate bounds.
With:
char test_src[] = "fuu\0foo";
This creates an array of size 8 with values:
{'f', 'u', 'u', '\0', 'f', 'o', 'o', '\0'}