[Klug-general] priapic numeracy

james morris james at jwm-art.net
Tue Sep 8 10:06:26 UTC 2009


/* priapic numeracy
    ----------------

        (c) James W. Morris 8th September 2009

        Licensed for modification and redistribution
        under the terms of the GNU GPL V3.
        For precise detail see:
            http://www.gnu.org/copyleft/gpl.html

    To build on GNU/Linux platforms,
    gcc priapic_numeracy.c -o priapic_numeracy

    To run after building
    ./priapic_numeracy
*/

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

int main()
{
    enum { SIZE = 10, LAST = SIZE - 1, MAX = 125 };
    long *a = malloc(SIZE * sizeof(long));
    if ( !a )
        return EXIT_FAILURE;
    long *last = a + LAST, *p;
    for ( p = a; p <= last ; p++ )
        *p = p - a;
    for ( p = a; *last < MAX; ++*p, p = ( p < last ? ++p : a ) )
        printf ( (p == last ? "%ld\n" : "%ld " ), *p);
    free ( a );
    return EXIT_SUCCESS;
}



More information about the Kent mailing list