C++ Pointers Interview Questions 2026: 28 Q&A With Code

What changed in 2026 drives
Mass-recruiter offer letters are flatter for 2026 batch - the 4-5 LPA ASE band has barely budged in three years while inflation eats real wages. Premium tracks (Digital, Pro, Elite, Specialist) are still where the differential lives, and they are entirely test-driven. If you are aiming higher than the default offer, the coding round is not optional pageantry - it is the entire interview.
What I'd actually study for this
- 01Two solid coding-round answers (1 medium-hard DSA each, with edge-case discussion) > five half-baked ones
- 02One real project you can defend end-to-end - file paths, design decisions, and what you would change
- 03One DBMS schema you actually built (not a textbook ER diagram), with at least 3 join-heavy queries written from memory
- 04Three behavioural STAR stories: failure recovered, conflict handled, ownership taken
Where most candidates trip up
The single biggest mistake is treating company-specific guides as primary prep and DSA as secondary. It is the opposite. Mass recruiters use the test as a filter, but premium tracks at every IT services company use coding to allocate offer band. Spend 70% of prep time on DSA + system fundamentals, 20% on company-specific patterns, 10% on HR rehearsal. Reverse that ratio and you collect the default offer.
Editorial commentary by Aditya Sharma · written for PapersAdda · not generated, not aggregated.
Last Updated: June 2026 | Level: Freshers to Mid-Level | Read Time: ~16 min
Pointers are the part of C++ that interviewers use to separate people who understand memory from people who memorise syntax. Candidates report that pointer versus reference, dynamic allocation, and dangling-pointer bugs are guaranteed for systems and product roles. This guide covers 28 pointer questions with full answers and predict-the-output traps. Behaviour reflects the official cppreference documentation; confirm any memory semantics on the standard.
Pair this with C++ Programming Placement Questions and C++ OOPs Interview Questions 2026.
Table of Contents
- Basics (Q1 to Q9)
- References and const (Q10 to Q16)
- Dynamic Memory (Q17 to Q23)
- Smart Pointers and Advanced (Q24 to Q28)
- Predict the Output
- Quick Revision Table
- Frequently Asked Questions
Basics
Q1. What is a pointer? Easy
int x = 5;
int* p = &x;
cout << *p; // 5
Q2. What is the difference between a pointer and a reference? Medium
Q3. What is a null pointer? Easy
Q4. What is a dangling pointer? Medium
Q5. What is a wild pointer? Easy
Q6. What is pointer arithmetic? Medium
int a[3] = {10,20,30};
int* p = a;
cout << *(p + 1); // 20
Q7. What is a void pointer? Medium
Q8. What is a function pointer? Medium
int add(int a,int b){return a+b;}
int (*fp)(int,int) = add;
fp(2,3); // 5
Q9. What is the difference between *p++ and (*p)++? Hard
References and const
Q10. What is a const pointer vs a pointer to const? Hard
Q11. Can a reference be null? Medium
Q12. What is pass by reference vs pass by pointer? Medium
Q13. What is a reference to const used for? Medium
Q14. What is an rvalue reference? Hard
Q15. What does std::move actually do? Hard
Q16. What is the difference between a reference and a pointer parameter for swapping? Medium
Dynamic Memory
Q17. What is the difference between new and malloc? Medium
Q18. What is the difference between delete and delete[]? Medium
Q19. What is a memory leak? Easy
Q20. What is a double free? Hard
Q21. How do you allocate a 2D array dynamically? Hard
vector<vector<int>> grid(rows, vector<int>(cols, 0));
Q22. What is the heap vs the stack? Medium
Q23. What happens if new fails? Medium
Smart Pointers and Advanced
Q24. What are smart pointers and why use them? Medium
Q25. What is the difference between unique_ptr and shared_ptr? Hard
Q26. What problem does weak_ptr solve? Hard
Q27. What is a dangling reference and how is it different from a dangling pointer? Hard
Q28. What is the difference between shallow and deep copy of a pointer member? Medium
Predict the Output
Snippet 1
int a[] = {10, 20, 30};
int* p = a;
cout << *(p + 2) << " " << *p + 2;
Output:
30 12
Why: *(p+2) reads the third element 30. *p + 2 reads the first element 10 and adds 2 to get 12. Precedence trap.
Snippet 2
int x = 5;
int* p = &x;
int** pp = &p;
**pp = 99;
cout << x;
Output:
99
Why: pp points to p which points to x; double dereference writes through to x.
Snippet 3
int* p = new int(7);
delete p;
cout << *p;
Output:
(undefined behaviour)
Why: p is dangling after delete; dereferencing freed memory is undefined. Set p = nullptr after delete.
Quick Revision Table
| Concept | Key takeaway |
|---|---|
| pointer vs reference | reseatable nullable vs fixed alias |
| dangling pointer | used after free, undefined |
| const placement | read right to left |
| new vs malloc | constructs vs raw bytes |
| delete vs delete[] | single vs array |
| smart pointers | auto free, no manual delete |
| weak_ptr | breaks shared_ptr cycles |
Frequently Asked Questions
What pointer topic is asked most in C++ interviews in 2026?
Candidates report that the difference between a pointer and a reference, dynamic allocation with new and delete, and dangling pointers and memory leaks are the most repeated C++ pointer questions.
Are smart pointers replacing raw pointers in interviews?
Modern interviews expect you to prefer unique_ptr and shared_ptr for ownership while still understanding raw pointers for non-owning access and pointer arithmetic.
What is the most common pointer bug in interviews?
The dangling pointer: using a pointer after the memory it points to has been freed or gone out of scope. Closely followed by double free and forgetting to delete, which leaks.
How do I read a complex pointer declaration like const int* const p?
Read right to left: p is a const pointer to a const int, meaning you can change neither the pointer nor the value it points to. Practising this right-to-left rule handles every combination.
Why do pointer-owning classes need a custom copy constructor?
Because the default copy is shallow and duplicates only the pointer value, leaving two objects sharing one allocation and risking a double free. A deep-copy constructor allocates fresh memory so the objects are independent.
Related Articles
- C++ Programming Placement Questions, the master set
- C++ OOPs Interview Questions 2026, classes and virtual functions
- C++ STL Interview Questions 2026, containers and algorithms
- C Pointers Interview Questions 2026, pointers in C
Confirm any pointer or memory semantics on the official cppreference documentation before your interview. This guide reflects candidate-reported patterns and public preparation resources as of June 2026.
Methodology applied to this articlelast verified 8 Jun 2026
- No fabricated salary numbers or success rates. If we quote a range, it's sourced.
- No noun-substituted templates. This article was not generated by swapping company names in a stock prompt.
- No paid placements, sponsored coaching links, or affiliate-shilled course pushes.
Explore this topic cluster
More resources in Interview Questions
Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.
Paid contributor programme
Sat this this year? Share your story, earn ₹500.
First-person experience reports help future candidates prep smarter. We pay verified contributors ₹500 via UPI per accepted story - with byline.
Submit your story →Ready to practice?
Take a free timed mock test
Put what you learned into practice. Our mock tests match the 2026 pattern with timer, navigator, reveal, and score breakdown. No signup.
Start Free Mock Test →Related Articles
Airbnb Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing Airbnb's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical, behavioural,...
Airtel Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing Airtel's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical, behavioural,...
AMD Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing AMD's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical, behavioural,...
Atlassian Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing Atlassian's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical,...
Barclays Interview Questions 2026
_Last verified by [Aditya Sharma](/author/aditya-sharma/) · cross-checked against PapersAdda Hiring Pulse and...
More from PapersAdda
Accenture Interview Process 2026: Rounds & Prep
Accenture Interview Questions 2026 (with Answers for Freshers)
Adobe Interview Process 2026: Rounds, OA & Aptitude
Amazon Interview Process 2026: Full Loop + Bar Raiser