typedefine怎么用
高洋zdy 2013-05-27 10:14:04 照书上抄的,咋不能运行?
代码如下:
#include<stdio.h>
typedefine chinesetype char[2];
typedefine englishtype char;
union wordtype{
chinesetype chineseword;
englishtype englishword;
}
int englishcount,chinesecount;
wordtype getnext(char*);
chinesetype getchineseword(char**point);
englishtype getenglishword(char**point);
main()
{
wordtype word;
char*currentpoint;
while(*currentpoint!='\0\')
{
word=getnext(currentpoint);
}
printf("english word in the file=%d/n",englishword);
printf("chinese word in the file=%d/n",chineseword);
}
wordtype getnext(char*bufp)
{
if((*bufp)>0x80)
return getchineseword(&bufp);
else return getenglishword(&bufp);
}
chinesetype getchineseword(char**point);
{
chinesetype word;
chinesecount++;
word[0]=**(point++);
word[1]=**(point++);
return(word);
}
englishtype getenglishword(char**point);
{
englishtype word;
englishcount++;
word=**(point++);
return(word);
}