Hi I am kind of new to pointers and I am trying write a function that switches one string with another without using any array notation, so completely with pointers.
I have got this function, which works, but in this one, I use one array notation.
Is there an easier, better way to do this? Thank you.
void stringtausch(char *eins, char *zwei) {
char first[50], *philfe = first, *one = eins, *two = zwei;
while(*one != '\0') {
*philfe++ = *one++;
}
*philfe = '\0';
while(*two != '\0') {
*eins++ = *two++;
}
*eins = '\0';
philfe = first;
while(*philfe != '\0') {
*zwei++ = *philfe++;
}
*zwei = '\0';
}