Thread: Syntax question: &(++x)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    5

    Syntax question: &(++x)

    Hi, just a weird syntax-related question. Why can't I do this:

    Code:
    some_function( &(++x) );
    where its passing a pointer to an already-incremented variable x? Seems to me it should be legal, but gcc complains about invalid lvalues. Any switches I can pass to make this code work? Cheers,
    Yoshi


    EDIT: In other words, why isn't ++x an lvalue? Two lines for one thing is so ugly :-)
    Last edited by yoshiznit123; 06-01-2006 at 06:15 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 09:09 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  5. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 05:32 PM