c++ - Declaring an array inside typedef struct -
i'm trying declare array inside typedef struct this: typedef struct node { node[] arr = new node[25]; }; but getting error saying "expected identifier" , arr "expected ';'. doing wrong? thank you you can act this struct node { static const int arr_size = 25; node* arr; node() { arr = new node[arr_size]; } ~node() { delete[] arr; } }; you re not allowed initialzie non const int varizbles inside class; and understand, creating node variable call stack overflow ? each node contains 25 nodes each node contains 25 nodes ... etc i think wanted this struct node { static const int arr_size = 25; node* arr[arr_size]; };