How does this code work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does this code work

These are two same codes written in java nd cpp respectively. One works fine the other generates error. Please explain its working https://code.sololearn.com/cTSN37AqLxXt/?ref=app https://code.sololearn.com/cgHjO54brV9q/?ref=app

20th Jul 2019, 9:46 AM
Ayush Pandey
Ayush Pandey - avatar
4 Answers
+ 1
It's because java cannot handle these values. C++ just fills it with a 0
20th Jul 2019, 10:01 AM
Airree
Airree - avatar
+ 1
You need initiliaze your java field first int a = .....;
20th Jul 2019, 10:09 AM
Dwi Novianto Nugroho
Dwi Novianto Nugroho - avatar
0
QUite tricky
20th Jul 2019, 10:02 AM
Ayush Pandey
Ayush Pandey - avatar
0
Dwi Novianto Nugroho but how still it works in cpp is it a specific characteristic of cpp
20th Jul 2019, 11:39 AM
Ayush Pandey
Ayush Pandey - avatar