01. ) during sorting , if we wish to swap the items in 2 positions , we simply swap the pointer values and leave the main data table unchanged:: what is a possible advantage and disadvantage of doing this .. ??

02. ) what would be the effect of incrementing a pointer to int
and increamenting a pointer to double

03. ) what would be the effect of changing the line (*p)++; to *p++; ??

04. ) what are the difference between stack allocation and heap allocation ??

Recommended Answers

All 3 Replies

Homework questions?

If you have a specific question; show your working and we can clear up any mis-understandings. Posting just questions won't get answers.

commented: Bravo, well said! +17

it is a theory question .. so no workings ...

Every question has workings; but not always code workings.

Some nudging into the right direction here:

01. ) If you imagine what you do with a non-pointer sorting. When you swap an item what do you do? How would performance be affected if the items were 'chars'; how would the performance be affected if the items were 1Gb arrays? What is the cost of a pointer swap?

02. ) In general what does incrementing a pointer mean?

03. ) This is an operator precedence question, each is parsed differently; bracket each one according to the operator table and the answer should pop out.

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.