There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
Hi bbac,
The pointer method can not determine the size of the array. It can determine the size of the string, but not the underlying buffer.
Which one is appropriate in a situation depends a lot on what you want to do with it.
-- Reserve a buffer in the program's variable block and preset it to "aFile.txt".
char filename[20] = "aFile.txt";
-- Reserve a buffer in the program's CONSTANTS block and preset it to "aFile.txt". Set variable to the address
char *filename = "aFile.txt";
In the first example, filename is an array and behaves just like any other array. The second example is subtlely different in that filename points to a string in read-only memory. Try to change the value (perhaps by capitalizing the first character) and the program will abort.
So that's the primary difference. One puts the buffer in the variables block and initializes it to your value. The other puts a pointer in the variables block and references memory in the constants block.
Good Luck,
Kent