summaryrefslogtreecommitdiff
path: root/reference/C/EXAMPLES/struct2.c
blob: e38cc7fd08b1aefd5b5dda8ec5c1842c24c3bcda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* 
 * Date 13-Jun-94
 *
 * 	Pass 'struct' elements to a function.
 */
#include <stdio.h>

void display(char *name, int age);

/************************************************************************/

main ()
{
  struct { char name[20]; int age;} record;

  strcpy(record.name, "Joe Brown");
  record.age = 21;

  display (record.name, record.age);
}

/************************************************************************/

void display(char *name, int age)
{
  printf("name is %s \nage is %d \n", name, age);
}