[ create a new paste ] login | about

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

C, pasted on Mar 26:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
int len = 0;
char str1(char string){
    char *p = &string;
    while(1){
        p = &string;
        if(*p == '\n'){
            break;
        } else {
            len = len + 1;
        }       
    }
    return len;
}
int main (void){
    char string = "Trung Dep Trai";
    len = str1(string);
    printf("Value of x = %d\n",len);
}
  


Output:
1
Killed


Create a new paste based on this one


Comments: