Dene a new type struct string that contains two members: char *chars is a pointer to some memory for storing a string value, and int size is the number of characters currently stored in that memory. Check your type denition using the following program. #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { struct string s = { strdup("hello"), 5 }; printf("\"%.*s\"\n", s->size, s->chars); return 0; }
typedef struct string { char* chars; int size; } string;