[ create a new paste ] login | about

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


Output:
1
2
3
4
In function 'str1':
Line 10: error: expected expression before ';' token
In function 'main':
Line 17: warning: passing argument 1 of 'str1' makes integer from pointer without a cast


Create a new paste based on this one


Comments: