Created
April 20, 2014 07:36
-
-
Save Technicus/11107686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
int sOcc(char *ptr, char specialChar); | |
main(){ | |
char myArray[80], search, *ptr; | |
int cnt=0; | |
printf(" Please enter a phrase... "); | |
gets(myArray); | |
printf(" Please enter a search char ..."); | |
scanf(" %c", &search); | |
printf(" I found %d search characters",sOcc(myArray,search)); | |
while(!kbhit()){} | |
} | |
int sOcc(char *ptr, char specialChar){ | |
int cnt=0; | |
while( *ptr != '\0'){ | |
if( *ptr == specialChar){ | |
cnt++; | |
} | |
ptr++; | |
} | |
return(cnt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment