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 |
What is fflush() function?
void main() { int x=25,y=32; clrscr(); x=x++ + y++; y=++x + ++y; printf("%d%d",x,y); }
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
write a c program in such a way that if we enter the today date the output should be next day's date.
const char * char * const What is the differnce between the above tow?.
What is function prototype?
Is a house a mass structure?
Differentiate between ordinary variable and pointer in c.
Why is %d used in c?
Sir i need notes for structure,functions,pointers in c language can you help me please
code for bubble sort?
Is c an object oriented programming language?