B
boogie_down77
Is it possible to declare and initialize a static node pointer in C? I
pass a node pointer in a function and I want to declare and initialize
a static node pointer and initialize it to the head of the linked list.
The last thing I do (or should I say, want to do)is to increment the
static pointer. However I keep getting a compile error which complains
that the initilizing value must be constant. How could this be? I
don't get an error when I simply declare: static NODEP static_pointer;
Can you not initialize a static pointer in C?
void function ( NODEPP linked_list )
{
static NODEP static_pointer; /* OK */
}
void function ( NODEPP linked_list )
{
static NODEP static_pointer = (*linked_list); /* not ok, why */
}
pass a node pointer in a function and I want to declare and initialize
a static node pointer and initialize it to the head of the linked list.
The last thing I do (or should I say, want to do)is to increment the
static pointer. However I keep getting a compile error which complains
that the initilizing value must be constant. How could this be? I
don't get an error when I simply declare: static NODEP static_pointer;
Can you not initialize a static pointer in C?
void function ( NODEPP linked_list )
{
static NODEP static_pointer; /* OK */
}
void function ( NODEPP linked_list )
{
static NODEP static_pointer = (*linked_list); /* not ok, why */
}