Good day to all, i'm just starting to learn c language...and i have a something to know ... is the opening curly bracket and closing curly bracket mean that it will end and begin a segment in c? thank you...
It is called as scope definition.It is C's way of assuring something similar and far less effective "Encapsulation" technique provided by C++.
It is a way by which we set a boundary to the usage of a specific variables.It is a way in which we define where is a particular variable valid.Example:
Some basics: 1>Variables declared in scope n are valid and can be used in scope m where n<m. 2>Variables declared in scope n have no meaning in scope m when n>m. 3>In case a variable with same name x is defined in scope n and scope m where n<m and operation on variable is carried out in scope m then the local value of x that is variable x of scope m is used.(General Rule : More local value will be used in the case of conflicts as above). 4>The above concept is just used to set boundaries for the variables.As shown above if a variable is declared in scope n then we limit its usage to scope m where m>=n but not in m<n.