<form action="/Dave/C/section2_5_7.html" METHOD="GET">
<input type="submit" value="Return to exercise">
</form>
 
The Solution is: 
<pre>
/* address2.c - Program to input name address and age to a
		C structure. Then outputs data.              */
		

#include <stdio.h>

/* define data strcuture */

struct person {
      char  forenames[30];
      char  surname[20];
      char  address[80];
      int   age;
      } data;
      
main()

{

   printf("Enter your forename(s) (1 line):\n");
   fgets(data.forenames, 30, stdin);
   
   printf("Enter your surname:\n");
   fgets(data.surname, 20, stdin);
   
   printf("Enter your address (use 1 line):\n");
   fgets(data.address, 80, stdin);
   
   printf("Enter your age (integer):\n");
   scanf("%d", &data.age);
   
   printf("\nPersonal details entered:\n\n");
   
   printf("\t\tForname(s): %s\n", data.forenames); 
           /* \t (tab) for pretty output */
           
   printf("\t\tSurname: %s\n", data.surname);
   
   printf("\t\tAddress: %s\n", data.address);
   
   printf("\t\tAge: %d\n", data.age);
 
   exit(0);
}
</pre>
<form action="/Dave/C/section2_5_7.html" METHOD="GET"> 
<input type="submit" value="Return to exercise">
</form>  
 
