Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int findM(char stringThing[10]){
- char * i = 0;
- int k = 0;
- const int j = -1;
- const char letM = 'M';
- i = strchr(stringThing, letM);
- if (i != NULL){
- k = atoi(i);
- return k;
- }
- else {
- return j;
- }
- }
- int main(void){
- int indexNums = 0;
- indexNums = findM("Find Meat");
- if(indexNums > 0){
- printf("%dn", indexNums);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement