+ 2

Variable scope

what is example of local variable??

31st Aug 2018, 5:29 PM
Dhruv Maru
2 Answers
+ 6
Any variable inside a block of code is local to that block. Blocks of code are loops, functions, classes, ...
31st Aug 2018, 5:46 PM
Eduardo Petry
Eduardo Petry - avatar
0
#include<stdio.h> int max=10; void main() { int d=34; } in this c++ code max is global variable & d is local variable. local variabl is only for {} this scop out side this scop it can not use. try your salf.
17th Sep 2018, 11:34 AM
Rushil Koyani
Rushil Koyani - avatar