Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can we declare a variable in different scopes with different
data types? answer in detail

Answers were Sorted based on User's Feedback



can we declare a variable in different scopes with different data types? answer in detail..

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

can we declare a variable in different scopes with different data types? answer in detail..

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

can we declare a variable in different scopes with different data types? answer in detail..

Answer / palani222samy

ya we can declare, ex: int array b[],
char array c[]

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

What is fflush() function?

0 Answers  


void main() { int x=25,y=32; clrscr(); x=x++ + y++; y=++x + ++y; printf("%d%d",x,y); }

5 Answers  


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?

0 Answers   TCS,


write a c program in such a way that if we enter the today date the output should be next day's date.

0 Answers  


const char * char * const What is the differnce between the above tow?.

6 Answers   Ramco, TCS,


What is function prototype?

0 Answers  


Is a house a mass structure?

0 Answers  


Differentiate between ordinary variable and pointer in c.

0 Answers  


Why is %d used in c?

0 Answers  


Sir i need notes for structure,functions,pointers in c language can you help me please

0 Answers   TCS,


code for bubble sort?

1 Answers  


Is c an object oriented programming language?

1 Answers  


Categories