Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Character position in C

#include<stdio.h>
#include<conio.h>

void main()
{
    char ss[20],aa;
    int flag=0;
    printf("\nenter the string");
    scanf("%s",ss);
    printf("\nenter the character to search");
    scanf("%c",&cc);
    for(i=0;i<strlen(ss);i++)
    {
        if(ss[i]==aa)
        {
          printf("the position of particular character is %d",i);
          flag=1;
        }
        else if(flag==0) printf("\n character not found");
    }
}