1 votes 1 votes dm4006 asked Jan 30, 2018 dm4006 653 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply hs_yadav commented Jan 30, 2018 reply Follow Share 3 5 5 5 3? ...Static scoping 0 votes 0 votes Raveena Yadav 1 commented Jan 30, 2018 reply Follow Share 3 5 8 8 3 0 votes 0 votes hs_yadav commented Jan 30, 2018 reply Follow Share Tesls ....idon't thing there would be any error because they are declaired within different scope....isn't it? and as default case we static scoping.... 1 votes 1 votes hs_yadav commented Jan 30, 2018 reply Follow Share @ Raveena Yadav you have used Dynamic Scoping ....but here it is not specified to use DS... 0 votes 0 votes Ashwin Kulkarni commented Jan 30, 2018 reply Follow Share It will print 3 5 5 5 3 0 votes 0 votes Manu Thakur commented Feb 1, 2018 reply Follow Share 35883 is the right answer using static scoping. C follows static scoping by default, even answer will be same even if dnamic scoping is considered in place of static scoping. 0 votes 0 votes Please log in or register to add a comment.
Best answer 0 votes 0 votes 35883 . is it right? $ruthi answered Jan 30, 2018 • selected Feb 1, 2018 by dm4006 $ruthi comment Share Follow See all 2 Comments See all 2 2 Comments reply dm4006 commented Jan 31, 2018 reply Follow Share 35883 is right answer plz explain 0 votes 0 votes $ruthi commented Feb 1, 2018 reply Follow Share int i=2;------------------------global variable main() { int i=3; ---------------------- local variable for main printf("%d",i); // prints 3 as it i is local variable. if int 'i' is not declared in main then it will take global variable 'i' { int i=5; // this 'i' is local to printf printf("%d",i); // prints the value 5 as it is local to printf. { i=i+3; // here as i is not declared so, take the value 5 which is global to this scope printf("%d",i); // it prints 8 } printf("%d",i); // after incrementing the value of 'i' with 3, it prints 8 } printf("%d",i); // this 'i' value is not changed so, it prints 3 } 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes any one please explain ..please i think 3 5 5 5 3??? air1ankit answered Jan 30, 2018 air1ankit comment Share Follow See all 0 reply Please log in or register to add a comment.