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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain goto?

707


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3331


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

609


What do you know about the use of bit field?

602


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

1718






code for replace tabs with equivalent number of blanks

1631


how logic is used

1493


What is wrong with this statement? Myname = 'robin';

812


What do you mean by command line argument?

636


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

708


What should malloc() do?

639


In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

1954


Explain how can I convert a string to a number?

638


What is a structure in c language. how to initialise a structure in c?

601


What is the difference between array and pointer?

560