L Value required error-Trying to increment array elements using element address

Discussion in 'C Programming' started by soby000, Mar 23, 2009.

  1. soby000

    soby000

    Joined:
    Mar 23, 2009
    Messages:
    1
    Likes Received:
    0
    for(i = 0; i < ARRAY_SIZE; i++)
    {
    *(array + i)++;

    if ( *(array + i) >= 10)
    {
    *(array + i) = 0;
    }
    }


    line is bold is the error line.It alows me below to using *(array...) just not where i increment it.Any ideas??Btw in the program im not allowed use subscripts i.e [] thats why im using + i.
    Thanks
     
    soby000, Mar 23, 2009
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jrefactors@hotmail.com

    why prefix increment is faster than postfix increment?

    jrefactors@hotmail.com, Oct 22, 2005, in forum: C Programming
    Replies:
    104
    Views:
    12,066
    Jordan Abel
    Oct 28, 2005
  2. jrefactors@hotmail.com
    Replies:
    99
    Views:
    2,994
    eliza81
    Jun 11, 2010
  3. tugnutt7@hotmail.com
    Replies:
    6
    Views:
    458
    James Kanze
    Feb 7, 2008
  4. candide
    Replies:
    65
    Views:
    1,816
    jameskuyper@verizon.net
    May 29, 2008
  5. John Koleszar

    address of static array element as address constant

    John Koleszar, Jul 7, 2008, in forum: C Programming
    Replies:
    7
    Views:
    810
    John Koleszar
    Jul 15, 2008
  6. Stanley Rice

    Address of array && address of pointer to array

    Stanley Rice, Sep 14, 2011, in forum: C Programming
    Replies:
    33
    Views:
    1,502
    Keith Thompson
    Sep 20, 2011
  7. nmvega
    Replies:
    1
    Views:
    338
    xhoster@gmail.com
    Oct 30, 2008
  8. Peng Yu

    post increment or pre increment?

    Peng Yu, Nov 21, 2008, in forum: Perl Misc
    Replies:
    7
    Views:
    838
    Peter J. Holzer
    Nov 23, 2008
Loading...