I will start with the code itself to explain my question
void main()
{
char arr[50];
for ( int i = 0; i < sizeof(arr); i++ )
arr[i] = '0';
up till here, every value that arr
holds is '0'
.
Now let us say I filled some of arr
values with characters, and got the following
arr = { '0', '0', 'Z', '0', 'A', 'b', 'Q', '0', '0', ..... '0' };
Now, I want to get rid of all the zeros after Q
, because it is the last value that is not a zero.
so when I printf ( " %s ", arr);
I only get in return all the values that arr
holds till that Q
I tried to use memset()
, but apparently I used it wrong, or that it doesn't serve my purpose