#include <stdio.h> // include funciton headers from stdo library
#include <time.h> // this gets us time() and localtime() function and types.
/////////////////////////////////////////////////////////
// prototypes
void get_year( int * ); // takes int pointer, and stores current year there.
void prompt_input ( int * ); // takes int pointer, and stores input there.
/////////////////////////////////////////////////////////
int main (void)
{
int * birth_year, * this_year;
prompt_input (birth_year); // takes pointer, returns nothing
printf("You entered: %d\n", *birth_year);
get_year(this_year);
printf("Date is %d\n", *this_year );
return 0;
}
/////////////////////////////////////////////////////////
void prompt_input ( int * input )
{
printf("Input your year of birth and press Enter.(i.e.1969): "); // prompt for input
scanf( "%d", input ); // read from stdin, store in address pointed to by input pointer.
return;
}
/////////////////////////////////////////////////////////
void get_year(int * year)
{
time_t tim=time(NULL); // declare variable
struct tm *now=localtime(&tim);
*year= (now->tm_year + 1900);
return;
}