c - How do I declare a pointer to a struct within a struct? -


instead of being int, prev pointer vertex. however, can't declare prev vertexpointer because typedef vertexpointer comes afterwards. how should declare prev?

#include <stdio.h> #include <stdlib.h> #include <time.h>   //function generates random float in [0,1] float rand_float();  //all info vertex typedef struct{     int key;     int prev;     float loc[4]; } vertex;  //using pointer typedef vertex *vertexpointer; 

you try this

typedef struct vertex{     int key;     struct vertex *prev;     float loc[4]; } vertex; 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -