Posts by LavaiBala • 25 points
2 posts
-
1
votes1
answer133
viewsQ: Dynamically allocating text, and error in free()
I’m trying to allocate dynamically, but the error is appearing: Error in . /name. c; invalid : 0x000001c18834 My code: // FUNCAO // char *nome(text[]) { int n3 = 0; int n2 = 0; char *n = NULL;…
-
1
votes1
answer71
viewsQ: Something simpler than that to allocate a dynamically typed text?
// FUNCAO // char *nome(char text[20]) { char *n; int n2; int n3 = 0; printf("%s\n",text); while((n2 = getchar()) != '\n' && n2 != EOF) { if(n3 < 1) { n = (char*) malloc(sizeof(char));//…