Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- void swap(char *a, char *b) {
- char temp[15];
- strcpy(temp, a);
- strcpy(a, b);
- strcpy(b, temp);
- }
- void print(int n, char p[][15]) {
- for (int i = 0; i < n; i++)
- printf("%s ", p[i]);
- printf("\n");
- }
- int main() {
- char test[4][15] = {"this", "is", "a", "test"};
- print(4, test);
- swap(test[2], test[3]);
- print(4, test);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement