Thread: Help with array of chars

  1. #16
    Registered User
    Join Date
    Jan 2013
    Posts
    48
    I was wondering if that was doing the same as a scanf, then why am i getting the output that i am getting.. Im not even getting to enter a sentence or anything at all

  2. #17
    Registered User
    Join Date
    Jan 2013
    Posts
    48
    AHhhh i fixed that by setting a c = getchar() before the while loop. Now, How would i fix the fact that once i do ./ex8-6 that i hit enter, then it is a blank line, then i hit enter then it prompts me for my Enter message: ??

  3. #18
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88
    Quote Originally Posted by clmoore3 View Post
    I was wondering if that was doing the same as a scanf, then why am i getting the output that i am getting.. Im not even getting to enter a sentence or anything at all
    scanf() and getchar() both take input from standard input (stdin) in this case your keyboard.

  4. #19
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88
    Quote Originally Posted by clmoore3 View Post
    AHhhh i fixed that by setting a c = getchar() before the while loop. Now, How would i fix the fact that once i do ./ex8-6 that i hit enter, then it is a blank line, then i hit enter then it prompts me for my Enter message: ??
    That is a logic issue and how you've set up your code. Think on what you want to happen and work it out in pseudo code, post your code afterwards and we'll take a look at it.

  5. #20
    Registered User
    Join Date
    Jan 2013
    Posts
    48
    Ok, i figured out what was wrong! Thanks so much for the help, running multiple test cases to make sure that it does work!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2D Array's, assigning chars.
    By gman89 in forum C Programming
    Replies: 9
    Last Post: 04-26-2008, 11:03 PM
  2. Saving chars to array
    By ReggieBE in forum C Programming
    Replies: 13
    Last Post: 03-26-2006, 11:11 AM
  3. cin to array of chars
    By cdonlan in forum C++ Programming
    Replies: 1
    Last Post: 02-25-2005, 01:00 PM
  4. Simple question about array of chars
    By Chewy in forum C Programming
    Replies: 9
    Last Post: 04-12-2004, 05:13 AM
  5. Array of pointers (chars)
    By Vber in forum C Programming
    Replies: 5
    Last Post: 02-08-2003, 04:29 AM