[問題] 有關strtok
請問下面的程式
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
char *sub_ptr;
char test[]="L=3";
sub_ptr=strtok(test,"=");
cout << "sub_ptr=" << sub_ptr << endl;
if(sub_ptr=="L")
cout << "sub_ptr=L" << endl;
else
cout << "sub_ptr!=L" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
sub_ptr就是L,但為什麼跳不進if(sub_ptr=="L")的判斷中
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.114.102
→
07/13 15:44, , 1F
07/13 15:44, 1F
→
07/13 15:45, , 2F
07/13 15:45, 2F
→
07/13 15:52, , 3F
07/13 15:52, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章