Example:
void world1(); //function declaration
void world2(); //function declaration
char c='*';
int i,j;
void main()
{
char *msg="I KNOWN FUNCTION";
clrscr();
world1(); //function call
printf("%c%22s%7c",c,msg,c);
world2(); //function call
getch();
}
void world1() //function definition
{
int a=-1;
for(i=0;i<15;i++)
{
a++;
for(j=0;j<30;j++)
{
if(j>=(15-a) && j<(15+a))
{
printf(" ");
}
else
{
printf("%c",c);
}
}
printf("\n");
}
}
void world2() //function definition
{
int a=-1;
for(i=0;i<16;i++)
{
a++;
for(j=30;j>0;j--)
{
if(j>a && j<=(30-a))
{
printf(" ");
}
else
{
printf("%c",c);
}
}
printf("\n");
}
}
No comments:
Post a Comment