[ create a new paste ] login | about

Link: http://codepad.org/XiP0o5qY    [ raw code | output | fork ]

C, pasted on Sep 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
int main() {
    int len = 25;
    char pat[] = "connection_receive_worker";
    char arr[] = "/usr/lib/smbsrv/smb3d'connection_receive_worker";
    //size_t strl = 
    printf("value %d\n",(unsigned)strlen(arr));
    
    for ( int i=0;i<strlen(arr);i++) {
        for (int j=0;j<strlen(pat)&&(i+j)<strlen(arr);j++){
            if ( pat[j] != arr[i+j] ) {
                break;
            }
            if ( j == strlen(pat)) {
                printf("pattern found\n");
            }
        }
    }
                
    return 0;
}


Output:
1
2
3
4
In function 'main':
Line 7: warning: incompatible implicit declaration of built-in function 'strlen'
Line 9: error: 'for' loop initial declaration used outside C99 mode
Line 10: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: