[ create a new paste ] login | about

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

C, pasted on Feb 15:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>
#include<string.h>

void printlength(char *s, char *t) {
    unsigned int c = 0;
    int len = ((strlen(s) - strlen(t)) > c )? strlen(s) : strlen(t);
    printf("%d\n", (strlen(s) - strlen(t)));
    printf("using unsigned int %u\n", (strlen(s) - strlen(t)));
    printf("using standard int %d\n", len);
}

void main() {
    char *x = "abc";
    char *y = "defgh";
    printlength(x,y);
}


Output:
1
2
3
-2
using unsigned int 4294967294
using standard int 3


Create a new paste based on this one


Comments: