函数声明例子

#include <stdio.h>
#include <windows.h>
#define NAME "GIGATHINK,INC"
#define ADDRESS "101 Megabuck Plaza"
#define PLACE "Megapolis,CA 94904"
#define WIDTH 40
#define SPACE ' '

void show_n_char(char ch,int num);

int main(void)
{
int spaces;
show_n_char('*',WIDTH);

putchar(' ');
show_n_char(SPACE,12);
printf("%s ", NAME);
spaces = (WIDTH - strlen(ADDRESS)) / 2;

show_n_char(SPACE,spaces);
printf("%s ", ADDRESS);
show_n_char(SPACE,(WIDTH-strlen(PLACE))/2);
printf("%s ", PLACE);
show_n_char('*',WIDTH);
putchar(' ');
system("pause");
return 0;
}


void show_n_char(char ch,int num)
{
int count;
for (count = 1; count <= num; count++)
putchar(ch);
}

原文地址:https://www.cnblogs.com/huqi001/p/15073500.html