Monday, June 25, 2018

Program that count number of char in the given string - DS (C Program)

#include<stdio.h>
void main()
{
char n[]="helllo",c={'a'};
char *p=&n[0];
int len=0;
clrscr();

while(*p!='\0')
{       if(*p==c)
len++;
p++;
}
if(len==0)
{     printf("No Match Found...");
}
else
{ printf("No of Char Match: %d",len);
}
getch();
}

No comments:

Post a Comment