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 the difference between fread buffer() and fwrite buffer()?
When should a type cast not be used?
What is queue in c?
Can static variables be declared in a header file?
Where does the name "C" come from, anyway?
How can I find out the size of a file, prior to reading it in?
How can you read a directory in a C program?
What is the full form of getch?
What is the purpose of sprintf() function?
What is operator precedence?
What is time null in c?
Are enumerations really portable?
which type of aspect you want from the student.
How arrays can be passed to a user defined function
What is the difference between a function and a method in c?