Thread: error C2105: '++' needs l-value

  1. #1
    Registered User
    Join Date
    Feb 2011

    error C2105: '++' needs l-value

    Hi, I've problem with compile this code (using VC++ 2010). I've got an error
    "error C2105: '++' needs l-value" ... on penultimate row but I can't figurate, what's the problem.

    int Push(double value)
    	if(stack == NULL)
    		return 1;
    	if(position+sizeof(double) > stack+size)
    		return 1;
    	*(double*)position = value;
    	((double*)position)++;              // ON THIS LINE I GET ERROR                        
    	return 0;

  2. #2
    Join Date
    Aug 2010
    somewhere in this universe
    Position has never been declared or passed into that function unless it's global. You can't just cast anything to a pointer and use pointer arithmetic.
    "All that we see or seem
    Is but a dream within a dream." - Poe

Popular pages Recent additions subscribe to a feed