Priapic Numeracy

/* 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;
}

Copy the text in the above box and save it as priapic_numeracy.c and then follow the instructions above.

Information

"Priapic Numeracy"

A short peice of C code demonstrating usage of 'for' and pointers.

Journal entry - 10:56 Tuesday 8 September 2009

DISCLAIMER: The opinions and attitudes of James W. Morris as expressed here in the past may or may not accurately reflect the opinions and attitudes of James W. Morris at present, moreover, they may never have.

Comments

# James Morris on 23:51 Saturday 29 October 2011:

Really don't have much idea what this is supposed to be about, it doesn't seem to demonstrate anything useful!

Opinions and attitudes expressed in comments may or may not accurately reflect the opinions and attitudes of those who claim to have made them. There is absolutely no guarantee whatsoever that the poster of comments is who they claim to be. IP addresses of machines posting comments, and email addresses provided by the poster will not be published nor divulged to third parties.

this page last updated:29th April 2013 jwm-art.net (C) 2003 - 2017 James W. Morris

script time:0.0658