+ 1

Though we aren't assigned any value for num and even we didn't get the user input,The output of this program came as -11932 How?

#include<stdio.h> int main() { int j, num; j=(num<0?0:num*num); printf("%d\n",j); return 0; } In Turbo C++

9th Aug 2020, 9:13 AM
Nandini B N
4 Réponses
+ 3
the variable num is not initialized, so it has an undefined value. it could be anything random, a value from memory that hasn't been freed.
9th Aug 2020, 9:23 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
Thank you Bahha🐧
9th Aug 2020, 9:28 AM
Nandini B N
0
Thank you AteFish
9th Aug 2020, 1:42 PM
Nandini B N