[問題] 指標字串的問題
請問以下程式碼 為什麼無法運行
code:
#include<iostream>
using namespace std;
int main()
{
char* pfruit("apple");
cout<<endl<<pfruit;
return 0;
}
運行後跳出
警告:deprecated conversion from string constant to 「char*」
[-Wwrite-strings]|
謝謝大家替小弟解惑> <
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.19.18
→
01/15 14:53, , 1F
01/15 14:53, 1F
→
01/15 14:55, , 2F
01/15 14:55, 2F
→
01/15 15:06, , 3F
01/15 15:06, 3F
→
01/15 15:08, , 4F
01/15 15:08, 4F
→
01/15 15:09, , 5F
01/15 15:09, 5F
→
01/15 15:09, , 6F
01/15 15:09, 6F
→
01/15 15:10, , 7F
01/15 15:10, 7F
→
01/15 15:11, , 8F
01/15 15:11, 8F
→
01/15 15:12, , 9F
01/15 15:12, 9F
→
01/15 15:12, , 10F
01/15 15:12, 10F
→
01/15 15:13, , 11F
01/15 15:13, 11F
→
01/15 15:14, , 12F
01/15 15:14, 12F
→
01/15 15:15, , 13F
01/15 15:15, 13F
→
01/15 15:16, , 14F
01/15 15:16, 14F
→
01/15 15:16, , 15F
01/15 15:16, 15F
推
01/15 15:17, , 16F
01/15 15:17, 16F
→
01/15 15:18, , 17F
01/15 15:18, 17F
推
01/15 15:20, , 18F
01/15 15:20, 18F
→
01/15 15:24, , 19F
01/15 15:24, 19F
→
01/15 15:30, , 20F
01/15 15:30, 20F
推
01/15 15:47, , 21F
01/15 15:47, 21F
→
01/15 16:04, , 22F
01/15 16:04, 22F
→
01/15 16:31, , 23F
01/15 16:31, 23F
→
01/15 16:32, , 24F
01/15 16:32, 24F
推
01/15 16:43, , 25F
01/15 16:43, 25F
→
01/15 16:45, , 26F
01/15 16:45, 26F
→
01/15 19:03, , 27F
01/15 19:03, 27F
→
01/16 01:15, , 28F
01/16 01:15, 28F
討論串 (同標題文章)