You would need to use a pointer to a pointer:
foo(struct node **n)
To change what n
points to, you do:
*n = t;
More Related Contents:
- How do I modify a pointer that has been passed into a function in C?
- Pointers program
- Are there differences between pointers to object stored on stack and heap? [closed]
- With arrays, why is it the case that a[5] == 5[a]?
- Length of array in function argument
- What is the difference between char * const and const char *?
- In C, are arrays pointers or used as pointers?
- Are all data pointers the same size in one platform for all data types? [duplicate]
- Dynamic memory access only works inside function
- Why can’t I convert ‘char**’ to a ‘const char* const*’ in C?
- size_t vs. uintptr_t
- C function pointer casting to void pointer
- Difference between char *str=”STRING” and char str[] = “STRING”?
- How to increment a pointer address and pointer’s value?
- How to printf a memory address in C
- What is the difference between far pointers and near pointers?
- Why can I change a local const variable through pointer casts but not a global one in C?
- Pointer Arithmetic: ++*ptr or *ptr++?
- Segmentation Fault when writing to a string [duplicate]
- Why is a point-to-volatile pointer, like “volatile int * p”, useful?
- Is the compiler allowed to recycle freed pointer variables?
- Can a pointer (address) ever be negative?
- In C, why can’t an integer value be assigned to an int* the same way a string value can be assigned to a char*?
- Mis-aligned pointers on x86
- How to find the size of an array (from a pointer pointing to the first element array)?
- Can I treat a struct like an array?
- Printing pointers in C
- lvalue required as increment operand
- pointer default value .?
- C pointer notation compared to array notation: When passing to function