← Cognizant questions

Swap two values in-place using pointers without third variable

Filed under Cognizant

Implement a function to swap two integer values in-place using pointers without using a third variable. Then, adapt the logic to demonstrate swapping using a pointer-to-pointer (double pointer).

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Cognizant questions

Collected from public candidate posts and coding forums. Updated Nov 2026.