Hi I tried to setup a code like
#include <stdio.h>
struct _data;
typedef struct _data data;
typedef struct _data {
    double x;
    double y;
} data;
const char* data_tostring(data* a) {
    static char buffer[255];
    sprintf(buffer, "%f %f", a->x, a->y);
    return buffer;
}
int main(){
    data a;
    data b;
    a.x = 0;
    a.y = 0;
    b.x = 1;
    b.y = 1;
    printf("%s %s \n", data_tostring(&a), data_tostring(&b));
    return 0;
}
I expected the output was 0 0 1 1, but actually I get 0 0 0 0. Did I make a mistake with the static keyword and the returning value in data_tostring()?
Thanks for the help.
 
     
     
    