#include <stdio.h>
#include <string.h>
main()
{
static char s1buf[] = "abcdefghijkl lkjihgfedcba";
int i;
char *status;
/* This program checks the strchr function by incrementally */
/* going through a string that ascends to the middle and then */
/* descends towards the end. */
for (i = 0; s1buf[i] != '\0' && s1buf[i] != ' '; i++) {
status = strchr(s1buf, s1buf[i]);
/* Check for pointer to leftmost character - test 1. */
if (status != &s1buf[i])
printf("error in strchr");
}
}