Expand|Select|Wrap|Line Numbers
- int in(char string[], char finder[]){
- int i = 0;
- int j = 0;
- int r = 0;
- int flag = 0;
- while (string[i] != '\0') {
- if (flag==0){ // If a part of finder has not yet been found in string
- if (string[i]==finder[0]){ // check if it is the first letter of finder is this string
- flag=1;
- }
- } else { // The letter has been found
- if (finder[j]!='\0'){
- j++;
- if (finder[j]==string[i]){
- r=1;
- } else {
- r=0;
- }
- }
- }
- i++;
- }
- return r;
- }
On GDB it says: Program received signal SIGSEGV, Segmentation fault.
0x08048539 in in ()