#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <ctype.h> // for isspace
#include <cstring> // for str functions

static const char * skip_white_space(const char *str)
{
    while(isspace(*str))
    {
        str++;
    }
    return (str);
}

static void print_str(const char *label, const char *str)
{
    cout << label << " = \"" << str << "\"" << endl;
}

void skip_white_space_example()
{
    char name1[30] = "  Fred";
    const char *str = skip_white_space(name1);
    print_str("name1", str);
    
    char name2[30];
    cout << "What is your name?" << endl;
    cin >> name2;
    
    str = skip_white_space(name2);
    print_str("name2", str);
}
    
int main (int argc, const char * argv[])
{
    skip_white_space_example();
    return 0;
}

