Can anyone clear this doubt..??
First C compiler program compiled on which compiler..???
int fun(int c)
the answer is 1...how??please reply ....
that prog doesn't give output 1. definitely output will be 0 only. because fun returns 1/2 i.e 0.5 but fun return type is int so fun returns 0 only.. check ur code once again
int &maxref(int &a, int &b)
int x=20,y=30, max=0;
cout<<"\n value of x is :"<<x;
cout<<"\n value of y is :"<<y;
This program output is
value of xis 20
value of y is : -1
but how to get this output?
because fun returns variable as return type is int &. if & is omitted in fun return type,value will be returned but it leads to error as invalid assignment in main function (20=-1).