Its memory wastage vs cpu utilization question.
If I want to merge 3 strings:
Approach 1: Should I take all string lengths (strlen) and then allocate.
char *s = malloc(strlen(s1)+strlen(s2)+strlen(s3)+1);
OR
Approach 2: I should assume
1025and allocate considering the fact that I know the strings will never go beyond 1025.#define MAX 1025 char *s = malloc(MAX);
Please suggest.