Computer 12 – Get User Input

Please enter the following code into your IDE as per instructed in class.

int GetUserInput(char* UserInput){
    
    int PlaceHolder=0;
    
    do{
        UserInput[PlaceHolder]=getc(stdin);
        PlaceHolder++;
    }while(UserInput[(PlaceHolder-1)]!='\n');

    return(PlaceHolder-1);
    
}

int main(int argc, char** argv) {
    char UserInput[255];
    
    
    printf ("What is your name? ");
    
    GetUserInput(UserInput);
    
    printf("Hello %s",UserInput);
    
    return 0;
}