- #1
Raghav Gupta
- 1,011
- 76
Homework Statement
This is the code on Turbo C++
Code:
char * disp()
{
int a [ ] = {49,15,50,34} ;
char c [ ] ="1234" ;
for (int i= 0; i<3 ; i++)
c[i] =a[i] + c[i];
cout<<c;
return c;
}
void main()
{
clrscr();
cout<<" ,"<<disp()<<endl;
getch();
}
1. bAe4, undefined
2. bAe4, bAe4
Homework Equations
The Attempt at a Solution
I ran the program on turbo c++ and it was giving me the 1st option as output (undefined here I guess means random symbols like smilies which were appearing on my screen).
I thought it should be the 2nd one.
I know how we are getting bAe4 which is related to ASCII manipulation.
The thing is that when we are returning the c, it would be holding the same characters.
So, in the cout statement of main(), we should get bAe4 once again.
Why is that not true?
Last edited by a moderator: