Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite+ 31
DOUBT CLEARING ZONE
Doubts regarding any programming languages especially questions from challenge section can be posted here so that we may get more concepts in that area from community(see by DATE to get the correct order)
7 Réponses
+ 1
int a,b;
a= 1,2,3,4,5;
b=(1,2,3,4,5);
cout <<a <<b;
Outputs: 15
How a and b outputs to 1 and 5 respetively?(It is one of the question in c++ belonging to challenge section)
This code will not even get compiled, because a is expected to be an integer and so is b, but what type of a value does b have there ? There should be no outputs but an error.
+ 14
int a = 10;
int b= 13;
int *p1=&a;
int *p2=&a;
*p1=b;
cout <<(*p1) +(*p2);
O/P :26
How??
+ 13
Ok Thank you so much Semih Mumcu 😊
+ 13
int a,b;
a= 1,2,3,4,5;
b=(1,2,3,4,5);
cout <<a <<b;
Outputs: 15
How a and b outputs to 1 and 5 respetively?(It is one of the question in c++ belonging to challenge section)
+ 1
by defining *p1=b , you basically change the variable value that &a carries which is "a". Since *p2 points to the same adress its value gets changed to b as well. Therefore *p1 and *p2 pointers are the same and equal to b which sums up to 13+13=26
+ 1
cout<<a will be 13, because you changed the value to b on whatever was in &a
+ 1
My pleasure ! Nirmalya Bakshi