Thread: Can a pointer accept user input?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by Programmer_P View Post
    Ok, thanks. That did it.
    On another note, I think I remember reading in a tut on this site that in a for loop, any one of the 3 fields (i.e. variable initialization, condition, or variable update) can be left blank if necessary, only the semicolons have to be there. But oddly enough that did not work.

    I had to change the

    Code:
    for ( ; x != 1; ; )
    line to a

    Code:
    for (int i; x != 1;)
    instead, before it worked.
    That first line has an errant semicolon. That's why it didn't work and why the other one does work.
    Last edited by whiteflags; 07-24-2009 at 03:49 AM.

  2. #2
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by whiteflags View Post
    That first line has an errant semicolon. That's why it didn't work and why the other one does work.
    What do you mean? It has 3 semicolons...one for the variable initialization (which was blank), one for the condition, and one for the variable update (which was blank too).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. timed user input
    By sainiabhishek in forum C Programming
    Replies: 4
    Last Post: 04-01-2009, 11:59 AM
  2. Truncating user input
    By CS_Student8337 in forum C Programming
    Replies: 10
    Last Post: 03-19-2009, 12:34 AM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. SSH Hacker Activity!! AAHHH!!
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-06-2005, 03:53 PM
  5. Nested Structures - User Input
    By shazg2000 in forum C Programming
    Replies: 2
    Last Post: 01-09-2005, 10:53 AM