In other words:VERSUSCode:char *chosen = malloc(255 * sizeof(chosen)); /* Use string here */ free(chosen);
Does it even matter? The only reason to use the first approach with pointers would be to make the program run faster? Wouldn't they be the same speed as far as usage?Code:char chosen[255]; /* Use string here */
This question comes up because I was doing a program that needed a string and I asked myself: "Why am I going like this?"
For any other reason besides practice? I must ask! I must search for a better reason!Code:char *chosen = malloc(255 * sizeof(chosen));