Program that prints the first characters of all the arguments except for the first

#include <stdio.h>
 
void flush_array(int,char *[]);
void flush_1st_char(int,char *[]);
 
int main(int argc,char *argv[])
{
   flush_array(argc,argv);
   printf("n=======> ");
   flush_1st_char(argc,argv);
   return 0;
}
 
void flush_array(int n,char *ptrarr[])
{
   while(--n > 0)
      printf("%s%c",*++ptrarr,(n>0)?' ':'n');
}
 
void flush_1st_char(int n,char *ptrarr[])
{
  while(--n > 0)
      printf("%c",(*++ptrarr)[0]);
  printf("n");
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.