Home > Programming > Functions using the "C" programming language > example07.c

 

Previous

Next


/*
    In this example we demonstrate how to pass stuctures as function parameters
*/

#include <stdio.h>

struct POINT {
    int x;
    int y;
};

/*
    Function prototype
*/
void print_point(struct POINT);

void main(void)
{
    struct POINT pt;
    pt.x = 4;
    pt.y = 10;
    print_point(pt);
}

/*
** print_point function source code
*/
void print_point(struct POINT p)
{
    printf("%d %d.\n",p.x,p.y);
}


© 2004 Jim Valavanis

Previous

Next

1