EDIT: I understand how strings and memory work in C now, this question was due to bad understanding
I have a char buffer which is 64 elements in size. Data is put into it by another function. I want to get all elements of the array which doesn’t equal null.
To explain it better, here is an example (pseudocode)
char[5] data;
data[0] = 'c';
data[1] = 'a';
data[2] = 't';
data[3]; // = null
getString(data); // Should return "cat"
Strings in C are represented by arrays of characters. These strings are terminated by the null (terminating) character. So if you manually build an array of characters, there is no way how to “get string from a character array”, because it is string already.
Functions like printf “run” through this array till they find terminating character, which is the reason why ‘x’ won’t get to output in my example.