#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[20],b;
char *ptr;
clrscr();
printf("\n Please Give The STRING OF A : ");
scanf("%s",a);
flushall();
printf("\n Please Give The CHARACTER TO B : ");
scanf("%c",&b);
ptr = strchr(a, b);
if (ptr)
printf("The character %c is at position: %d\n", b, ptr-a+1);
else
printf("The character was not found\n");
getch();
}
******************************OUTPUT ****************************************
Please Give The STRING OF A : World
Please Give The CHARACTER TO B : r
The character Y is at position: 3
*****************************************************************************