ok i have an assigment to implement a binary directory tree
we have to use enumeration with labels Folder and File
we have to define type struct FOLDER with elements: name which is a dynamicly string,left and right pointer to the structure and indentifiar which is type enum
we have to define struct FILE with elements name identifiar and int data
the part above is clear to me
but the second part is blurry
define a function which inserts a childe node to the specific node and if that new node has the identifiar File it should be casted from type FOLDER* to type FILE*, the information of the node should be inserted in theis function
THIS IS REALLY CONFUSING TO ME
view source
print?
Code:Code:
01 typedef enum TIP
02 {
03 Folder,
04 File
05 }TIP;
06 typedef struct folder
07 {
08 char *name;
09 TIP ident;
10 struct folder *left,*right;
11 }FOLDER;
12 typedef struct datoteka
13 {char *name;
14 int data;
15 TIP ident;