Consider the following code:

**a.c**

```
#include <stdio.h>
#include "b.h"

static int a = 41;

static void test(void){
    a++;
    printf("a: %d\n", a);
}

int main(void){
    set_callback(test);
    call();

    return 0;
}

```

**b.c**

```
static void (*callback)(void);

void set_callback(void (*func)(void)){
    callback = func;
}

void call(void){
    if (callback){
        callback();
    }
}

```

**b.h**

```
void set_callback(void (*func)(void));
void call(void);

```

This compiles without warnings with `-Wall` and prints out `a: 42` as expected.

Now, this might not be the best practice, since the writer of `a.c` probably doesn't expect `test()` to be called from another file and the variable `a` modified, but is this legal C code? Will it work portably on different platforms and compilers?