c語言用sizeof求字節(jié)數(shù) C語言中如何判斷一個字符是空格?
C語言中如何判斷一個字符是空格?#include<stdio.h>#include<string.h> int getwordNums(const char*STR){if(STR==
C語言中如何判斷一個字符是空格?
#include<stdio.h>#include<string.h> int getwordNums(const char*STR){if(STR==null){put(“null指針…”。。。n “)return-1}int count=0 char*P1=null char*P2=(char*)STR while(*P2!=“0”{如果(P1==null&*P2!=”)//P1依次指向每個單詞的第一個字母{P1=P2}if(P1!=null&&*P2}==“”//word scan的結(jié)尾{count P1=null}return count}int main(void){puts(“input your string:”)char STR[1024]=“”get(STR)printf(“nums:Dn”,getword ums(STR))return 0}