swapping strings (which are stored in an array)
I am new to programming, new to the C language, and new to this forum.
My question deals with manipulating the elements of an array which store strings, (strings being an array of chars). Specifically, I want to know how to swap the contents of one element (which contains a string) with the contents of another element (which contains a string).
Say I define an array as follows:
How can I swap the contents "Hello", found at stuff, with "World" found at stuff?
I am familiar with swapping elements in an array, doing something like:
but I have only been able to do it successfully with arrays storing integers. When I try to do it with arrays storing strings, I run into problems. I have a shallow understanding of strings in C. I don't know if I am suppose to be using pointers, if I am suppose to be loading certain libraries like <string.h>, or if I should be using some other approach I am not even considering. I've got a shallow understanding of pointers too, and I've never even used the <string.h> library before. The K&R book's appendix explains some of the things I can do with <string.h>, but I haven't been able to apply those things to my problem.
So far, strings have proved very difficult for me to manipulate. Integers seem so much friendlier in C.