Function in a text buffer
hi! i'm new in this programming stuff and now i need to make a text buffer with struct:
Code:
typedef struct textbuffer *TB;
struct textbuffer{
char* text; //it's gonna be a string
TB next;
};
now the problem is i need to write a function:
Code:
TB newTB(char text[]);
when newTB is called, a list will be created because the input will have more than one line of text and we need to initialise it using char text[]. and every time it find '\n' the next text will be stored in the next node, and terminated with '\0'
can anyone give me the c prog for this one? i'm really slow at understanding the adt!! what is adt anyway? thanks!