What exactly is a C pointer if not a memory address?

In a reputable source about C, the following information is given after discussing the & operator: … It’s a bit unfortunate that the terminology [address of] remains, because it confuses those who don’t know what addresses are about, and misleads those who do: thinking about pointers as if they were addresses usually leads to grief… … Read more

How come an array’s address is equal to its value in C?

In the following bit of code, pointer values and pointer addresses differ as expected. But array values and addresses don’t! How can this be? Output my_array = 0022FF00 &my_array = 0022FF00 pointer_to_array = 0022FF00 &pointer_to_array = 0022FEFC #include <stdio.h> int main() { char my_array[100] = “some cool string”; printf(“my_array = %p\n”, my_array); printf(“&my_array = %p\n”, … Read more

Forward an invocation of a variadic function in C

In C, is it possible to forward the invocation of a variadic function? As in, int my_printf(char *fmt, …) { fprintf(stderr, “Calling printf with fmt %s”, fmt); return SOMEHOW_INVOKE_LIBC_PRINTF; } Forwarding the invocation in the manner above obviously isn’t strictly necessary in this case (since you could log invocations in other ways, or use vfprintf), … Read more