#include <stdio.h> /* 提供NULL的定义 */ char * strblk (char * string) { while (*string != ' ' && *string != '\0') string++; /* 在第一个空格或空字符处停止 */ if (*string == '\0') return NULL; /* NULL是空指针 */ else return string; }
#include <stdio.h> /* 提供NULL的定义 */ char * strblk (const char * string) { while (*string != ' ' && *string != '\0') string++; /* 在第一个空格或空字符处停止 */ if (*string == '\0') return NULL; /* NULL是空指针 */ else return (char *) string; }
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题
#include <stdio.h> /* 提供NULL的定义 */ char * strblk (char * string) { while (*string != ' ' && *string != '\0') string++; /* 在第一个空格或空字符处停止 */ if (*string == '\0') return NULL; /* NULL是空指针 */ else return string; }#include <stdio.h> /* 提供NULL的定义 */ char * strblk (const char * string) { while (*string != ' ' && *string != '\0') string++; /* 在第一个空格或空字符处停止 */ if (*string == '\0') return NULL; /* NULL是空指针 */ else return (char *) string; }