When we use "return 4,5" in c++ it does not give error but instead returns 5 (at least 4 would be understandable as it should return the first number it encounters) . Why does this happen and can we use this to return 2 values in any way?
Here is the code that i tried
#include<iostream>
using namespace std;
int something()
{
return 4,5;
}
int main()
{
int a=0,b=0;
a,b = something();
cout<<a<<b<<endl;
}
also in the above code for some reason 5 is assigned to b instead of a