can we declare a variable in different scopes with different
data types? answer in detail
Answer Posted / rajasekhar
yes we can declare the same variable with different data types in different scopes...
y bcoz as the scope ends the availability of that particular variable also ends..
so, if u create a variable which is declared in the another scope there will be no error...
ex: void main()
{
int a;
}/*the availability of a has ended here*/
int print()
{
char a;
return 0;
}/* as this is next scope, the variabla declared in the main function does not affect this function*/
hope u understood
thank u
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What is anagram in c?
What are the loops in c?
What is maximum size of array in c?
Explain what is the most efficient way to store flag values?
How can I manipulate individual bits?
What is function prototype in c language?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
How we can insert comments in a c program?
What is %lu in c?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
All technical questions
What is a nested loop?
What are lookup tables in c?
Why does the call char scanf work?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?