How the value gets same after increment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How the value gets same after increment

C ,auto variables topic

11th Jan 2021, 3:48 PM
Ajith
Ajith - avatar
4 Answers
+ 3
Ajith Because you didn't initialised bj that's why 99 is assigned to bj. If you initialised bj with value then you will not get that.
11th Jan 2021, 4:44 PM
A͢J
A͢J - avatar
+ 1
Tq aj
11th Jan 2021, 6:19 PM
Ajith
Ajith - avatar
0
#include<stdio.h> int ajit() { int aj; printf("%d\n",aj); aj=99; printf(%d\n,aj); } int bji() { int bj; printf("%d\n",bj); bj++; printf("%d\n",bj); } int main() ajit(); bji(); return 0; } Final output is 0 99 99 100
11th Jan 2021, 3:53 PM
Ajith
Ajith - avatar
0
How values are getting allocated to bj ..help me wizards
11th Jan 2021, 3:54 PM
Ajith
Ajith - avatar