1#include <assert.h>2#include <stdio.h>3#include <string.h>45/*6output:7testing8done9end:10*/1112int13main()14{15 char *p, buf[] = "abcad";1617 puts("testing");1819 p = strchr(buf, 0);20 assert(p == buf+5);21 assert(*p == '\0');2223 p = strchr(buf, 'a');24 assert(p == buf);25 assert(*p == 'a');2627 p = strchr(buf, 'd');28 assert(p == buf+4);29 assert(*p == 'd');3031 p = strchr(buf, 'c');32 assert(p == buf+2);33 assert(*p == 'c');3435 p = strchr(buf, 'h');36 assert(p == NULL);3738 p = strchr("", 'a');39 assert(p == NULL);4041 puts("done");4243 return 0;44}