I was writing some C code and I got the following problem. Suppose we have this really simple program: 

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

struct this {
    char* str;
};

char* freeStrReturnPointer(struct this * t) {
    free(t->str);
    return t->str;
};

int main() {
    // standard mallocing going on
    struct this* t = malloc(sizeof(struct this));
    t->str = malloc(sizeof(char)*10);
    // here is the problematic part!
    freeStrReturnPointer(t) = NULL;
    // end of problematic part
    free(t);
    exit(0);
}

```

Compilation gives the following problem:

```
test.c: In function ‘main’:
test.c:18:29: error: lvalue required as left operand of assignment
     freeStrReturnPointer(t) = NULL;

```

My question is: If the function freeStrReturnPointer returns a pointer char\*, why can I not set it to NULL? The following would definitely work:

```
char* p;
p = NULL;

```

What is the difference here? Why can I not assign a value to the returned pointer immediately?

Caveat: I realize I can just set the pointer to null in the function, but that is not the point of the question.