+ 2
hi friends thank you watch this question ,i want to know why te last output "name" like that
10 odpowiedzi
+ 10
Then what is it. If you do not elaborate on your question, it would be hard to help you.
+ 8
Putting the bad practices aside:
name was originally initialized with 5. You created multiple instances of the same class. You called input() on s2, which will display name value as your input value. Your last output on name is on s3, a newly initialized instance of the class, so name will be 5.
+ 8
it is junk value. could be any number. ☺ odd that it differs
+ 7
not sure I understand your question.. because it uses the default value 5
+ 7
when code references an uninitialized value. it can print any value. i.e int x; cout << x;
but it 'should' print 5 in your code. thus 'odd'
+ 1
I'm sorry but the name of s3 it's not 5 on Code::Blocks
+ 1
it's a very large number, I think it is a address of the memory
but I can't explain it
+ 1
I still not understand it ,can't you say more easily
+ 1
OK 🆗 thank you so much I know it now
0
@Hatsy Rei