Member Avatar for I_m_rude

never mind sir! actually, I dnt know how i misunderstood that "yes". sorry for that.

Member Avatar for I_m_rude

sir, Can you tell me one thing that

*p++=c;

In this, firstly, (p++) will be evaluated as we go from right to left. you said that as it post increment , so it will evaluates to value first then increment the value. So my question here is that, "p" itself will use it's value . why is it using the value to which it is pointing to. making myself clear, I am asking that ( p++) will evalutes first as you said. it is ok with me. so as post increment, it should use its value first then increment. it is also ok with me. but, isn't it should use its own value(address, not the object to which it is pointing, i mean) . and then

1.using its own value for assignment,
2.then increment its own value,
3, then use the value to which it point to using "*" operator.

Please clear my doubt. thanks in advance. waiting for reply.

Let's break it down completely into separate statements:

/*
    *p++ = c;
*/
int *temp = p;
*temp = c;
p = p + 1;

Throughout the entire expression, the value of p before the increment is used. Then after the expression reaches a sequence point (the semicolon in this case), the "temporary" variable is destroyed and p evaluates to the incremented value.

The operators are applied in a somewhat unintuitive way. First the ++ binds to p, so you're incrementing the address stored in p. Next, the * binds to the unincremented address due to how the postfix increment operator works. Finally, the assignment operator is applied on the result of the dereference, so c is assigned to the pointed to object.

Member Avatar for I_m_rude

Sir, Can you give me tips that how can i visualize 3-D array, 4-D array. like if an conceptual question come in my hand, then how to imagine these multi dimensional arrays in mind or on copy.
thanks. please reply.

Just stack them on top of each other. A 2D array is a stack of 1D arrays, a 3D array is a stack of 2D arrays, and a 4D array is a stack of 3D arrays. If you get to a 5D array, you have my sympathy. I've used them before (they were dynamic too), and it's excruciatingly tedious.

Member Avatar for I_m_rude

hahahhaa.. I laughed heavily when you said "my sympathy". ya! sir I know they are too tedious. ;) hahh. good sense of humour. any further visualization ? please further visualization I want here for this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.