This is actually just a small part of the original assignment I have in algorithms and data structure. At some point I'm supposed to write a function that swaps two elements in an array of strings.
The prototype we have to use is:
void swap(char *a, char *b);
To me it makes much more sense passing double pointers to this function (if swapping strings). In fact, I don't know how to make their prototype work without using double pointers. Am I missing something or is this wrong?
I've done my research on this a while ago and there are many answered questions here, I'm just wondering whether the person who was designing this assignment made a mistake.
swapfunction ifaandbpoint to the same amount of memory (or an excessive amount of memory). E.g.char s1[100] = "hello", s2[100] = "world"; swap(s1, s2)