[ create a new paste ] login | about

Link: http://codepad.org/E7BypIgF    [ 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){
        if(*p == '\n'){
            break;
        } else {
            *p++;
            len++;
        }       
    }
    return len;
}
int main (void){
    char string[10]="Trung Dep ";
    len = str1(string);
    printf("Value of x = %d\n",len);
}
  


Output:
1
2
3
Value of x = 18

Exited: ExitFailure 16


Create a new paste based on this one


Comments: