Returning from a Function - C Function

C examples for Function:Function Return

Introduction

A function terminates execution and returns to the caller when the last statement in the function has executed.

For example,

Demo Code

#include <string.h>
#include <stdio.h>

void pr_reverse(char *s);

int main(void) {
   pr_reverse("I like C");

   return 0;//w  w w  .  j a  v a 2 s  .  c  o m
}

void pr_reverse(char *s)
{
   register int t;

   for (t = strlen(s) - 1; t >= 0; t--) putchar(s[t]);
}

Related Tutorials