I was just experimenting with a int array. And something just came to my mind. Can I nul terminate it. For example, I am using a 0 to nul terminate. Ho
Well, you can also change your sentinel from \0 to \\0. And, accordingly, a slight modification in the condition for while loop will get you around your problem.
while(*p != '\\0')
Now, 0 will not be treated as terminator for the integer array and the whole array gets printed.