187k views
0 votes
To open a file with a user supplied name, you would need to store the name in a variable. If the file name was to have no more than 20 characters in it, which would be an appropriate declaration of the file name variable?

a. char filename;
b. char filename(20);
c. char filename[20];
d. char filename[21];

User Slcott
by
5.9k points

1 Answer

2 votes

Answer: C: char filename[20];

Step-by-step explanation:

In c++ the squre brackets or simply brackets "[]" is used to denote memory allocation, memory access and so on,

User Justin DeMaris
by
6.0k points