Created
February 26, 2014 01:37
-
-
Save Technicus/9221705 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| void main(){ | |
| char theArray[80], searchChar; | |
| int index=0, count=0; | |
| printf("\n Enter the phrase.\n\n"); | |
| gets(theArray); | |
| printf("\n What character do you want to find: "); | |
| scanf(" %c", &searchChar); | |
| printf("\n You are looking for: %c \n", searchChar); | |
| //scanf(" %s", &theArray[0]); | |
| while( theArray[index] != '\0'){ | |
| if (theArray[index] == searchChar){ | |
| count++; | |
| } | |
| index++; | |
| } | |
| printf(" Length = %d\n", index); | |
| printf(" count = %d\n", count); | |
| printf("\n ECHO: %s\n\n", theArray); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment