📜  C |指针基础问题15

📅  最后修改于: 2021-06-29 04:04:34             🧑  作者: Mango

#include
  
void swap (char *x, char *y)
{
    char *t = x;
    x = y;
    y = t;
}
  
int main()
{
    char *x = "geeksquiz";
    char *y = "geeksforgeeks";
    char *t;
    swap(x, y);
    printf("(%s, %s)", x, y);
    t = x;
    x = y;
    y = t;
    printf("\n(%s, %s)", x, y);
    return 0;
}

(一种)

(geeksquiz, geeksforgeeks)
(geeksforgeeks, geeksquiz)

(B)

(geeksforgeeks, geeksquiz)
(geeksquiz, geeksforgeeks)

(C)

(geeksquiz, geeksforgeeks)
(geeksquiz, geeksforgeeks)

(D)

(geeksforgeeks, geeksquiz)
(geeksforgeeks, geeksquiz)

答案: (A)
说明:请参见C函数以交换字符串
这个问题的测验

想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。