0

What should be the value of i and k at the end of the following program segments?

int i,j,k; { j=5; i=2*j/2; k=2*(j/2); }

25th May 2018, 11:05 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
12 Respostas
+ 3
BlazingMagpie This was the feature I was making fun of: https://code.sololearn.com/cm2F6IW8r7kV/?ref=app It was a play on scope: This i vs that i. PS: You were right about it not being uninitialized, scope works in hierarchy.
26th May 2018, 8:44 AM
non
+ 1
We've been there an hour ago. OP wanted to get result on screen.
25th May 2018, 12:33 PM
BlazingMagpie
BlazingMagpie - avatar
25th May 2018, 7:53 PM
BlazingMagpie
BlazingMagpie - avatar
0
5 and 4 Do your homework yourself.
25th May 2018, 11:06 AM
BlazingMagpie
BlazingMagpie - avatar
0
this program output is no output
25th May 2018, 11:20 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
0
why print command ,because i'm already value decleared
25th May 2018, 11:26 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
0
#include <stdio.h> main() { int i,j,k; j=5; printf("%d %d",i,j); i=2*j/2; k=2*(j/2); }
25th May 2018, 11:37 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
0
#include <stdio.h> main() { int i,j,k; j=5; printf("%d %d",i,j); i=2*j/2; k=2*(j/2); }
25th May 2018, 11:37 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
0
Put print at the end instead of the middle. Before }
25th May 2018, 11:38 AM
BlazingMagpie
BlazingMagpie - avatar
0
like that but output is wrong
25th May 2018, 11:38 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
0
nonzyro Nope, the variables don't return to uninitialised state. Just like in blocks after if statements and for loops you can set values outside said blocks and they won't reset back. By the way, how do I tag someone?
25th May 2018, 4:30 PM
BlazingMagpie
BlazingMagpie - avatar
- 1
this progrom is not out given
25th May 2018, 11:08 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar