hi all im stuck to my assignment
1. i want to know how to use function search in order i can search each character in a string then count the number of it.
for example: given : home alone
the output will be :
the string has 9 characters including the white space.
if i want to search character a in the string
the output will be
1 a found in the string home alone.
if i want to search y in the string the output will be
no y is found in the string home alone
so far this is the code that i made:
#include<stdio.h>
#include<string.h>
void searchCount(char*TEXT, char z);
int main(){
int string_size;
char a;
char name[]="HAPPY BIRTHDAY";
name[strlen(name)-1]='\0';
printf("find a character>>");
scanf("%c", &a);
searchCount(name,); //this part i have to calling searchCount function but i have no idea which argument i have to pass in
printf("The string has %d characters including white space.",i);
return 0;
}
void searchCount(char *TEXT, char z){
//no idea to put in//
return count;
}
i think i have to use switch but serious i dont understand how to mix it with pointer,pls any idea?