I have an array that is a "NULL-terminated array of NULL-terminated strings". This is given by char **args.
I can access individual elements using args[0], args[1], etc. I wanted to take the entire array and flatten all the elements into a string. If the array contained:
args[0] = "abc"
args[1] = "def"
I want a resulting string to be:
abcdef
I tried to do this by looping through all the elements and concatenating them all together but I do not know how to tell when I have reached the end of the array because sizeof() does not work.
I have an array that is a "NULL-terminated array of NULL-terminated strings".
The array ends with NULL, that is as soon as args[i] == NULL you stop your iteration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With