Skip to main content
deleted 81 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23

C - 8864 characters, 8864 points

c(*a,*b){return strcmp(a,b);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,cstrcmp);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strcmp(a, b);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), cstrcmp);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

I also decided to include sorting of characters, just because I could.

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999
$ ./test 4789359uihjasvb8ygohq9poi3n4jiouy58g
3344557888999abgghhiiijjnooopqsuuvyy

C - 88 characters, 88 points

c(*a,*b){return strcmp(a,b);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strcmp(a, b);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

I also decided to include sorting of characters, just because I could.

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999
$ ./test 4789359uihjasvb8ygohq9poi3n4jiouy58g
3344557888999abgghhiiijjnooopqsuuvyy

C - 64 characters, 64 points

main(int a,char**b){b++;qsort(*b,strlen(*b),1,strcmp);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), strcmp);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

I also decided to include sorting of characters, just because I could.

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999
$ ./test 4789359uihjasvb8ygohq9poi3n4jiouy58g
3344557888999abgghhiiijjnooopqsuuvyy
added 167 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23

C - 88 characters, 88 points

c(*a,*b){return strcmp(a,b);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strcmp(a, b);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

I also decided to include sorting of characters, just because I could.

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999
$ ./test 4789359uihjasvb8ygohq9poi3n4jiouy58g
3344557888999abgghhiiijjnooopqsuuvyy

C - 88 characters, 88 points

c(*a,*b){return strcmp(a,b);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strcmp(a, b);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999

C - 88 characters, 88 points

c(*a,*b){return strcmp(a,b);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strcmp(a, b);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

I also decided to include sorting of characters, just because I could.

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999
$ ./test 4789359uihjasvb8ygohq9poi3n4jiouy58g
3344557888999abgghhiiijjnooopqsuuvyy
deleted 4 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23

C - 9288 characters, 9288 points

c(*a,*b){return strncmpstrcmp(a,b,-1);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strncmpstrcmp(a, b, -1);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999

C - 92 characters, 92 points

c(*a,*b){return strncmp(a,b,-1);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strncmp(a, b, -1);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999

C - 88 characters, 88 points

c(*a,*b){return strcmp(a,b);}main(int a,char**b){b++;qsort(*b,strlen(*b),1,c);puts(*b);}

You might wonder how I get this to work without any headers. Simple, compile with:

gcc -include stdio.h stdlib.h string.h test.c -o test --std=gnu11 -Wall -g -O3

Un-golfed:

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

c(*a, *b)
{
    return strcmp(a, b);
}

main(int a, char **b)
{
    b++;
    qsort(*b, strlen(*b), sizeof(char), c);  // sizeof(char) is guaranteed to be 1 by standards
    puts(*b);
}

Test runs:

$ ./test 132815
112358
$ ./test 423791
123479
$ ./test 1234767189728975213132471243985123957120837412
0111111112222222233333344445556777777788889999
Bug fix
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading
deleted 4 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading
deleted 20 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading
added 38 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading
deleted 2 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading
deleted 1 characters in body
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading
Source Link
syb0rg
  • 1.1k
  • 7
  • 23
Loading