网站稳定性不好的原因,商城类型的网站怎么做,电商网站建设功能需求,娄底优秀网站建设【FROM MSDN 百科】 原型#xff1a; char *strchr(const char *s,char c); #includestring.h 查找字符串s中首次出现字符c的位置,返回首次出现c的位置的指针#xff0c;如果s中不存在c则返回NULL。 //#define FIRST_DEMO
#define SECOND_DEMO
#ifdef F… 【FROM MSDN 百科】 原型 char *strchr(const char *s,char c); #includestring.h 查找字符串s中首次出现字符c的位置,返回首次出现c的位置的指针如果s中不存在c则返回NULL。 //#define FIRST_DEMO
#define SECOND_DEMO
#ifdef FIRST_DEMO
#include stdio.h
#include conio.h
#include string.h
#pragma warning (disable:4996)
int main(void)
{char string[17];char *ptr;char cT;strcpy(string,This is a string);ptrstrchr(string,c);if (ptr){printf(The character %c is at position:%d\n,c,ptr-string);}else{printf(The character was not found\n);}getch();return 0;
}
#elif defined SECOND_DEMO
#include stdio.h
#include conio.h
#include string.h
#pragma warning (disable:4996)
int main(void)
{char answer[100];char *p;printf(Type something:\n);fgets(answer,sizeof answer,stdin);if ((pstrchr(answer,\n))!NULL) /*fgets不会像gets那样自动地去掉结尾的\n所以程序中手动将\n位置处的值变为\0,代表输入的结束。*/{*p\0;}printf(You typed \%s\\n,answer);getch();return 0;
}
#endif