#Why the second output is 0 instead of 5?

34 messages · Page 1 of 1 (latest)

harsh marsh
stable pathBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#

@harsh marsh

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

harsh marsh
#

I thought, since I am passing by reference I have set the variable Marks equal to 5 permanently

sonic hedge
#

you are passing an pointer in

harsh marsh
#

Ohh

sonic hedge
#

that said this should set marks to five

#

oh UO2 is 0 cause it's not initialized

pliant nebula
#

You're making a new instance of the ujju class, and not initializing the Marks member field

sonic hedge
#

in fact the value of Marks is undetermined due to it not being initalized

harsh marsh
#

I see

#

What about this one, is this the case of passing by reference?

sonic hedge
#

non of these are by reference

#

it's called pass by reference in C but C++ actually has references

harsh marsh
#

means whoever taught this in tutorial was wrong

harsh marsh
#

Which IDM do you recommend btw?

sonic hedge
#

IDM?

harsh marsh
#

yeah like visual studio, codeblock

#

IDE sorry

sonic hedge
#

visual studio 100%

harsh marsh
#

alright! thanks

stable pathBOT
#

@harsh marsh Has your question been resolved? If so, type !solved :)

modern merlin
#

do u need help understanding pointers?

harsh marsh
#

Btw I thought I had closed this post

harsh marsh
#

!solved

hallow boughBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

next jay
modern merlin
#

i think that’s a bit ahead of him

hollow hamlet
#

Hello is it possible to link cpp to to html? If possible how can I link c++ with html please

sonic hedge