4 喜歡 0 不喜歡
114 瀏覽

The following program stores two strings in two arrays, swaps them, and displays their new content. Is there any error? Please explain.

 

#include <stdio.h>

int main()

{

char temp[100];

char str1[100] = "Let see";

char str2[100] = "Is everything OK?";

temp = str1;

str1 = str2;

str2 = temp;

printf("%s %s", str1, str2);

return 0;

}

 

References: C From Theory

[正常] 開放式問答 - 最新提問 分類:Introduction to Computer Programming I (C) | 用戶: (20.9k 分)
ID: 21962 - 從幾時開始: 無限制 - 到幾時結束: 無限制

修改於 用戶: | 114 瀏覽
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.139
©2016-2024

相關問題

4 喜歡 0 不喜歡
0 回答
[正常] 開放式問答 - 最新提問 2月 19, 2017 分類:Introduction to Computer Programming I (C) | 用戶: The Contributor (20.9k 分)
ID: 21960 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 142 瀏覽
5 喜歡 0 不喜歡
1 回答
[正常] 開放式問答 - 最新提問 2月 19, 2017 分類:Introduction to Computer Programming I (C) | 用戶: The Contributor (20.9k 分)
ID: 21973 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 187 瀏覽
5 喜歡 0 不喜歡
0 回答
[正常] 開放式問答 - 最新提問 2月 19, 2017 分類:Introduction to Computer Programming I (C) | 用戶: The Contributor (20.9k 分)
ID: 21972 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 146 瀏覽
4 喜歡 0 不喜歡
0 回答
[正常] 開放式問答 - 最新提問 2月 19, 2017 分類:Introduction to Computer Programming I (C) | 用戶: The Contributor (20.9k 分)
ID: 21966 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 124 瀏覽
4 喜歡 0 不喜歡
0 回答
[正常] 開放式問答 - 最新提問 2月 19, 2017 分類:Introduction to Computer Programming I (C) | 用戶: The Contributor (20.9k 分)
ID: 21965 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 152 瀏覽
12,783 問題
183,443 回答
172,219 留言
4,824 用戶