jweinst1
10/12/2017 - 6:48 PM

moves a char pnt to the first non space character in the string

moves a char pnt to the first non space character in the string

#include "stdio.h"
#include "ctype.h"

//function that moves char ptr to first non space character.
void moveToNSpace(const char* mes, char** pos)
{
  while(isspace(*mes)) mes++ ;
  *pos = mes;
}



int main(void) {
  const char* note = "    What's up people?";
  printf( "%s\n", note);
  moveToNSpace(note, &note);
  printf( "%s\n", note);
  return 0;
}

/*
    What's up people?
What's up people?
*/