Hope you got it, the reason why it didn’t work is because you need to dereference the pointer src in your while statement because otherwise it only has the address of the char, you need to dereference it to get the actual char. Also, \0 should be wrapped in '' for chars because it is represents the zero constant character, (which is actually just the int 0), so all together…
while (*src != '\0') {
...
}
Also, an array is a collection of data stored in contiguous places in memory. In c, an array points to the first element of the array. To get to the other elements, it just adds however many bytes the element is to get to the next element, but it seems you already know that based on your code . So, instead of doing &srcString[0] you could just do srcString, and same with the others, but it’s all up to you
Now I feel humbled. Thank you very much such a simple mistake but I for the life of me couldn’t find it. I was using the [0] method as I just learned it and wanted to it’s use. Of course [0] is practically reduantant.
All in all thanks for the constructive feedback. Have a nice day.
I understand the feeling, just remember it’s all part of the learning process and coding in general (even professionals do), I experience it as well. It’s always good to want to use what you learned, so no worries. Also thanks, I am glad I could be of help! Hope you have a nice day as well!
I was actually looking back on the solution, and I realized I made a mistake in something I said. Even though I did say you could do srcString, there is a difference between both. I had come across this (you only need to read the first part of Joe’s answer):
With this in mind, I think the way you did it is the correct way than what I had proposed.