Which is faster/more effecient in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which is faster/more effecient in C++?

Which is better of the two? 1. int a=2; int b=a; 2. int a=2; int *b = &a;

5th Apr 2019, 8:19 PM
Cheese Burger Joe
Cheese Burger Joe - avatar
1 Answer
+ 5
They accomplish 2 different things. For integers, the second one is the same, or slower, but for structures it's much faster.
5th Apr 2019, 8:33 PM
Vlad Serbu
Vlad Serbu - avatar