Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
problem with swaping the numbers in c++
int A{10}; int B{20}; int *num1{&A}; int *num2{&B}; int *temp{num1}; num1 = num2 ; num2 = temp; Here I have observed that *num1 and *num2 swapped but not A & B........ why??????
1 ответ
+ 1
//Instead
Int *temp{num1};
//Use
Int *temp = num1;
Got idea from this link. Plz check it out
https://stackoverflow.com/questions/15672805/c-swapping-pointers
Hope it helps you