4 added 9 characters in body
source | link

C, 230 200200 193 characters

EDIT: Shortened it from 230 to 200193 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a,b,w,i,l;
int main(int c,char **v){
    for(i=0;(a<256)||(b<256);i++;a<256||b<256;i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b-a:a;a-b;
    printf("%s %i\n",v[w+1],l);
}

Or the uglier version:

int a,b,w,i,l;int main(int c,char **v){for(i=0;(a<256)||(b<256);i++;a<256||b<256;i++){if(!v[1][i])a|=256;if(!v[2][i])b|=256;if(!(a&256))a++;if(!(b&256))b++;}a&=255;b&=255;w=a>b?0:1;l=w?b-a:a;printfa-b;printf("%s %i\n",v[w+1],l);}

Example output:

N:\>golf.exe everything works
everything 105

C, 230 200 characters

EDIT: Shortened it from 230 to 200 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a,b,w,i,l;
int main(int c,char **v){
    for(i=0;(a<256)||(b<256);i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b:a;
    printf("%s %i\n",v[w+1],l);
}

Or the uglier version:

int a,b,w,i,l;int main(int c,char **v){for(i=0;(a<256)||(b<256);i++){if(!v[1][i])a|=256;if(!v[2][i])b|=256;if(!(a&256))a++;if(!(b&256))b++;}a&=255;b&=255;w=a>b?0:1;l=w?b:a;printf("%s %i\n",v[w+1],l);}

Example output:

N:\>golf.exe everything works
everything 10

C, 230 200 193 characters

EDIT: Shortened it from 230 to 193 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

a,b,w,i,l;
int main(int c,char **v){
    for(;a<256||b<256;i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b-a:a-b;
    printf("%s %i\n",v[w+1],l);
}

Or the uglier version:

a,b,w,i,l;int main(int c,char **v){for(;a<256||b<256;i++){if(!v[1][i])a|=256;if(!v[2][i])b|=256;if(!(a&256))a++;if(!(b&256))b++;}a&=255;b&=255;w=a>b?0:1;l=w?b-a:a-b;printf("%s %i\n",v[w+1],l);}

Example output:

N:\>golf.exe everything works
everything 5
3 added 236 characters in body
source | link

C, 230 200 characters

EDIT: Shortened it from 230 to 200 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a,b,w,i,l;
int main(int c,char **v){
    for(i=0;(a<256)||(b<256);i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b:a;
    printf("%s %i\n",v[w+1],l);
}

Or the uglier version:

int a,b,w,i,l;int main(int c,char **v){for(i=0;(a<256)||(b<256);i++){if(!v[1][i])a|=256;if(!v[2][i])b|=256;if(!(a&256))a++;if(!(b&256))b++;}a&=255;b&=255;w=a>b?0:1;l=w?b:a;printf("%s %i\n",v[w+1],l);}

Example output:

N:\>golf.exe everything works
everything 10

C, 230 200 characters

EDIT: Shortened it from 230 to 200 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a,b,w,i,l;
int main(int c,char **v){
    for(i=0;(a<256)||(b<256);i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b:a;
    printf("%s %i\n",v[w+1],l);
}

Example output:

N:\>golf.exe everything works
everything 10

C, 230 200 characters

EDIT: Shortened it from 230 to 200 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a,b,w,i,l;
int main(int c,char **v){
    for(i=0;(a<256)||(b<256);i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b:a;
    printf("%s %i\n",v[w+1],l);
}

Or the uglier version:

int a,b,w,i,l;int main(int c,char **v){for(i=0;(a<256)||(b<256);i++){if(!v[1][i])a|=256;if(!v[2][i])b|=256;if(!(a&256))a++;if(!(b&256))b++;}a&=255;b&=255;w=a>b?0:1;l=w?b:a;printf("%s %i\n",v[w+1],l);}

Example output:

N:\>golf.exe everything works
everything 10
2 Shortened code.
source | link

C, 230 200 characters

EDIT: Shortened it from 230 to 200 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a[2]a,b,w,i;i,l;
int main(int c,char **v){
    for(i=0;(a[0]<256a<256)||(a[1]<256b<256);i++){
        if(!v[1][i])a[0]|=256;a|=256;
        if(!v[2][i])a[1]|=256;b|=256;
        if(!(a[0]&256a&256))a[0]++;a++;
        if(!(a[1]&256b&256))a[1]++;b++;
    }
    a[0]&=255;a[1]&=255;a&=255;b&=255;
    w=a[0]>a[1]w=a>b?0:1;
    l=w?b:a;
    printf("%s %i\n",v[w+1],a[w]l);
}

Example output:

N:\>golf.exe everything works
everything 10

C, 230 characters

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a[2],w,i;
int main(int c,char **v){
    for(i=0;(a[0]<256)||(a[1]<256);i++){
        if(!v[1][i])a[0]|=256;
        if(!v[2][i])a[1]|=256;
        if(!(a[0]&256))a[0]++;
        if(!(a[1]&256))a[1]++;
    }
    a[0]&=255;a[1]&=255;
    w=a[0]>a[1]?0:1;
    printf("%s %i\n",v[w+1],a[w]);
}

Example output:

N:\>golf.exe everything works
everything 10

C, 230 200 characters

EDIT: Shortened it from 230 to 200 characters.

My first golf attempt. Maybe not a hole-in-one, but it works. Not being allowed to use strlen for this forces it to be fairly verbose in C. Maybe it can be shortened a bit?

int a,b,w,i,l;
int main(int c,char **v){
    for(i=0;(a<256)||(b<256);i++){
        if(!v[1][i])a|=256;
        if(!v[2][i])b|=256;
        if(!(a&256))a++;
        if(!(b&256))b++;
    }
    a&=255;b&=255;
    w=a>b?0:1;
    l=w?b:a;
    printf("%s %i\n",v[w+1],l);
}

Example output:

N:\>golf.exe everything works
everything 10
1
source | link