Pass char pointer to a function - C Function

C examples for Function:Function Parameter

Description

Pass char pointer to a function

Demo Code

#include <stdio.h>

void print_vertical(char *str);  /* prototype */

int main(int argc, char *argv[])
{
   if (argc > 1) print_vertical(argv[1]);

   return 0;/* www.java  2  s.co m*/
}

void print_vertical(char *str)
{
   while (*str)
      printf("%c\n", *str++);
}

Related Tutorials