hi all i just wanted to know whether we can declare variable name as structure name.
for example
typedef struct
{
char c;
}t;
then in some function can i use
fun()
{
t t;
}
is this valid? if so then how compiler differentiate between them?
Yes, it is valid. If you do that, then the structure type is hidden in the enclosing scope and t refers only to the declared variable.
Yes, but why would you want to? If you want bugs and errors to thrive in your project, then go right ahead and name variables after types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With