List function prototype before main function - C Function

C examples for Function:Function Definition

Description

List function prototype before main function

Demo Code

#include<stdio.h>

void sqr_it(int *i); /* prototype */

int main(void)
{
   int x;/*from   ww w .  j a v a  2s  .  co m*/

   x = 10;

  // sqr_it(x);  /* type mismatch */

   printf("%d", x);
   return 0;
}
void sqr_it(int *i)
{
   *i = *i * *i;
}

Result


Related Tutorials