Passing pointer to C array to a function
What do I misunderstand about passing pointers to char arrays?

<pre>
Request pointer in fun: 0x7fffde9aec80
Response pointer in fun: 0x7fffde9aec80
Response pointer: (nil), expected: 0x7fffde9aec80
Response itself: (null), expected: Yadda
</pre>


    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>

    int get_response(char *request, char **response) {
        response = &request;
        printf("Request pointer in fun: %p\n", request);
        printf("Response pointer in fun: %p\n", *response);
        return 0;
    }

    int main() {
        char *response = NULL, request[] = "Yadda";

        get_response(request, &response);

        printf("Response pointer: %p, expected: %p\n", response, request);
        printf("Response itself: %s, expected: %s\n", response, request);

        return 0;
    }
Passing pointer to C array to a function
===

What do I misunderstand about passing pointers to char arrays?

<pre>
Request pointer in fun: 0x7fffde9aec80
Response pointer in fun: 0x7fffde9aec80
Response pointer: (nil), expected: 0x7fffde9aec80
Response itself: (null), expected: Yadda
</pre>


    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>

    int get_response(char *request, char **response) {
        response = &request;
        printf("Request pointer in fun: %p\n", request);
        printf("Response pointer in fun: %p\n", *response);
        return 0;
    }

    int main() {
        char *response = NULL, request[] = "Yadda";

        get_response(request, &response);

        printf("Response pointer: %p, expected: %p\n", response, request);
        printf("Response itself: %s, expected: %s\n", response, request);

        return 0;
    }