I keep getting this error:

Code:
main.c:55:8: error: dereferencing pointer to incomplete type ‘struct structptr’
     toe->ptr = malloc(sizeof(structptr));
        ^~

From this code.



Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>


typedef struct {
    
} blank;


typedef struct {
    
    struct blank *ptr;
    struct data_node *data; 
    
} structptr;


typedef struct {
    
    int val;
    float x;
    float y;
    char test;
    
} data_node;


struct structptr *toe = NULL;
struct structptr *curr = NULL;
struct structptr *node_t = NULL;
struct blank *ptr = NULL;
struct data_node *data = NULL;


struct structptr  *create_rootfn(){
    
    toe = malloc(sizeof(structptr));
    if(toe == NULL){
        return NULL;
        printf("%s", "create_rootfn failed");
    }
    
    //toe->ptr = NULL;
    toe->ptr = malloc(sizeof(structptr));
    toe->ptr = NULL;
    
    toe->data = malloc(sizeof(structptr));
    toe->data->val = 0;
    toe->data->x = 0;
    toe->data->y = 0;
    toe->data->test = 1;


    printf("create_rootfn completed\n toe address = %p\n float = %f\n", toe, toe->data->x);    
    return toe;    
}

Nevermind what I'm doing and why there is a blank struct, that is irrelevant. Trust me, I've moved things around and the blank struct has no bearing on the outcome. I know it's 'not-standard', but this is an experiment into writing linked lists in reverse. Either way, doesn't matter. I have declared the appropriate structs and nothing seems to work.

I also thought the sizeof parameter might be causing the issue:

Code:
toe->data = malloc(sizeof(structptr));
So I tried to dereference toe, like this:

Code:
toe->data = malloc(sizeof(*toe));

But that throws the same error.

Interestingly enough, I CAN use toe as parameter to sizeof here:

Code:
toe = malloc(sizeof(toe));
    if(toe == NULL){
        return NULL;
        printf("%s", "create_rootfn failed");
    }
And it works...

Any advice as to why this error is thrown would be greatly appreciated. Please refrain from commenting on the validity of the experiment or better ways to write linked lists.

If viewing the entire code would help in solving this quandary, then you have only to ask.

Cheers,
MedicineMan25