// lethead2.c
#include <stdio.h>
#include <string.h>
const char* NAME = "GIGATHINK, INC";
const char* ADDRESS = "101 Megabuck Plaza";
const char* PLACE = "Megapolis, CA 94904";
const int WIDTH = 40;
const char SPACE = ' ';

// prototype of the function
void show_n_char(char ch, int num);

int main(void)
{
	int spaces;
	// using constants as arguments
	show_n_char('*', WIDTH);
	putchar('\n');
	show_n_char(SPACE, 12);
	printf("%s\n", NAME);
	// let the program calculate how many spaces to skip
	spaces = (WIDTH - strlen(ADDRESS)) / 2;
	// use a variable as argument
	show_n_char(SPACE, spaces);
	printf("%s\n", ADDRESS);
	// an expression as argument
	show_n_char(SPACE, (WIDTH - strlen(PLACE)) / 2);
	printf("%s\n", PLACE);
	show_n_char('*', WIDTH);
	putchar('\n');
	
	return 0;
}

/* show_n_char definition */
void show_n_char(char ch, int num)
{
	int count;
	

	for (count = 1; count <= num; count++)
		putchar(ch);
}
