You swap each pair of letters ... and then immediately swap them back.
For C-strings of even length you can change line 10 to for (i = 0; i < SIZE - 1 && s[i] != NULL && s[i+1] != NULL; i += 2) {
Note the comparing of s[i] and s[i+1] rather than i with NULL, and incrementing by 2 each time rather than 1 (which would simply swap the letters back).
You will have to decide what you actually want to do with odd-length strings.
The slightly abbreviated form for (i = 0; i < SIZE - 1 && s[i] && s[i+1] ; i += 2) {
will also work.
Personally, I think it more logical to leave the function to do the switching and then put the final cout << s; in main().
// Java program to demonstrate character swap
// using toCharArray().
public class GFG {
static char[] swap(String str, int i, int j)
{
char ch[] = str.toCharArray();
char temp = ch[i];
ch[i] = ch[j];
ch[j] = temp;
return ch;
}
public static void main(String args[])
{
String s = "geeksforgeeks";