Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C program

Name: Anonymous 2010-07-13 18:06

Make me a C program that reads given two integers (no limits) and outputs the largest.

Do this in a proper GNU hello.c way.

Name: Anonymous 2010-07-15 3:23

#include <stdio.h>

int ab(char *a, char *b) {
    while(*a!='\0'&&*a==*b&&*a++&&*b++); return *a-*b;
}

int main(int ac, char **a) {
    int c = ac<3?0:ab(a[1], a[2]);
    printf("%s\n",ac<3?"the fuck?!":c>0?a[1]:a[2]);
    //printf("%s\n",ac<3?"fuck off":c>0?"1st greater":c<0?"2nd greater":"equal");
    return 0;
}

Name: Anonymous 2010-07-15 3:35

>38
>while(*a!='\0'&&*a==*b&&*a++&&*b++); return *a-*b;
while(*a!='\0'&&*b!='\0'&&*a==*b&&*a++&&*b++); return *a!='\0'&&*b!='\0'?*a-*b:*a=='\0'&&*b=='\0'?0:*a=='\0'?-1:1;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List