为什么在C++里会出错?
#include<stdio.h>
#include<string.h>
void main()
{
char * temp;
char * tokenPtr;
char string[]="this is a sentence which 7 tokens";
tokenPtr=strtok(string," ");
temp=tokenPtr;
while(tokenPtr!=NULL)
{
tokenPtr=strtok(NULL," ");
if(strlen(temp)<strlen(tokenPtr)&&tokenPtr!=NULL)
temp=tokenPtr;
}
printf("the longest word is:%s\n",temp);
}