Question: How do you do the SwapStringsAlt function? It is another version of the swap string function for the 2D array. #define NUM_STRINGS 4 #define STRING_LENGTH

How do you do the SwapStringsAlt function? It is another version of the swap string function for the 2D array.

#define NUM_STRINGS 4

#define STRING_LENGTH 32

// Forward Declarations

void initializeStrings(char[NUM_STRINGS][STRING_LENGTH]);

void reverseString(char strings[NUM_STRINGS][STRING_LENGTH]);

void encryptStrings(char[NUM_STRINGS][STRING_LENGTH], int);

void decryptStrings(char[NUM_STRINGS][STRING_LENGTH], int);

void swapStrings(char[STRING_LENGTH], char[STRING_LENGTH]);

void sortStrings(char[NUM_STRINGS][STRING_LENGTH]);

void printStrings(char[NUM_STRINGS][STRING_LENGTH]);

void reversePrint(char[NUM_STRINGS][STRING_LENGTH]);

void initializeStrings(char strings[NUM_STRINGS][STRING_LENGTH])

{

for (int i = 0; i < NUM_STRINGS; i++) {

for (int f = 0; f < STRING_LENGTH; f++) {

strings[i][f] = '\0';

}

}

}

void swapStrings(char string1[STRING_LENGTH], char string2[STRING_LENGTH])

{

char temporary[STRING_LENGTH];

stringcopy(temporary, string1);

stringcopy(string1, string2);

stringcopy(string2, temporary);

}

// The following solution is also correct:

void swapStringsAlt(char *string1, char *string2)

{

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!