can we declare a variable in different scopes with different
data types? answer in detail
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / tatukula
Yes,
why because that variable scope is ends with in that block only...
int main()
{
int a=20;
printf("%d\n",a);
{
char a='c';
printf("%c\n",a);
}
printf("%d\n",a);
}
output: 20 c 20
| Is This Answer Correct ? | 0 Yes | 0 No |
ya we can declare, ex: int array b[],
char array c[]
| Is This Answer Correct ? | 1 Yes | 3 No |
a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21
const char * char * const What is the differnce between the above tow?.
What is methods in c?
write a program to add two numbers of any size.....(remember any size)
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Binary tree traversing
the format specified for hexa decimal is a.%d b.%o c.%x d.%u
wap in c to accept a number display the total count of digit
Explain how can I write functions that take a variable number of arguments?
Why C language is a procedural language?
Input any no. and print all the the numbers that comes before it like this for e.g input = 4 0 01 012 0123 01234 plz answer it 2day
How many levels deep can include files be nested?