Define and use variable in your own function - C Function

C examples for Function:Function Definition

Description

Define and use variable in your own function

Demo Code

#include <stdio.h>
void dropBomb(void);                     /* prototype */
int main()//  w w  w  . j  a v  a 2s.co m
{
   printf("Press Enter to drop the bomb:");
   getchar();
   dropBomb();
   printf("Yikes!\n");
   return(0);
}
void dropBomb()
{
   int x;
   for(x=20;x>1;x--)
   {
      puts("               *");
   }
   puts("            BOOM!");
}

Result


Related Tutorials