Skip to content

Commit

Permalink
char* --> char
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdkiki committed Feb 9, 2024
1 parent 1b8082f commit 8aa72e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/ex-sizeof/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ int forgot_parens()
size_t capacity = BLOCK_SIZE;
size_t size = 0;

char *str = (char *)malloc(capacity * sizeof(char*));
char *str = (char *)malloc(capacity * sizeof(char));
while (1) {
char c = getchar();
if (c == EOF) break;

if (size == capacity) {
str = (char *)realloc(str, capacity + BLOCK_SIZE * sizeof(char*));
str = (char *)realloc(str, capacity + BLOCK_SIZE * sizeof(char));
capacity += BLOCK_SIZE;
}

Expand Down

0 comments on commit 8aa72e4

Please sign in to comment.