K
KevinSimonson
I had a job interview yesterday in which I was asked to find as many
bugs as possible in a section of C code. Part of the code said:
struct Node
{ struct Node* next;
int data;
};
and later a variable was declared
struct Node** xyz;
and later on in the code an expression included the phrase "xyz::next"
which as far as I could tell was the equivalent of "(*xyz)->next". Is
this a legal use of the "::" operator? I wasn't aware that the "::"
operator was even _legal to use_ in C; I thought it was a C++
operator. Any input on this would be greatly appreciated.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
bugs as possible in a section of C code. Part of the code said:
struct Node
{ struct Node* next;
int data;
};
and later a variable was declared
struct Node** xyz;
and later on in the code an expression included the phrase "xyz::next"
which as far as I could tell was the equivalent of "(*xyz)->next". Is
this a legal use of the "::" operator? I wasn't aware that the "::"
operator was even _legal to use_ in C; I thought it was a C++
operator. Any input on this would be greatly appreciated.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_