K
karthikbalaguru
Hi,
I have 2 different set of codes and have a
query based on it.
Set 1
--------
typedef struct Hello
{
int Hi,
Hello,
Hey;
}Hello;
main()
{
Hello h1;
h1.Hello =1;
printf("%d",h1.Hello);
}
In the above code,
The 3 usages of name Hello in the above code(Set 1) appears to
be identifiable / distinguishable by the compiler at any
single instance as the compiler does not show any error.
But, In the below code(Set 2), why does the compiler throw errors ?
Set 2
--------
typedef enum HelloType
{
Hi,
Hello,
Hey,
}Hello;
main()
{
Hello h1;
h1=1;
printf("%d",h1);
}
Any ideas ?
Thx in advans,
Karthik Balaguru
I have 2 different set of codes and have a
query based on it.
Set 1
--------
typedef struct Hello
{
int Hi,
Hello,
Hey;
}Hello;
main()
{
Hello h1;
h1.Hello =1;
printf("%d",h1.Hello);
}
In the above code,
The 3 usages of name Hello in the above code(Set 1) appears to
be identifiable / distinguishable by the compiler at any
single instance as the compiler does not show any error.
But, In the below code(Set 2), why does the compiler throw errors ?
Set 2
--------
typedef enum HelloType
{
Hi,
Hello,
Hey,
}Hello;
main()
{
Hello h1;
h1=1;
printf("%d",h1);
}
Any ideas ?
Thx in advans,
Karthik Balaguru