“hard coding” means putting something into your source code. If you are not hard coding, then you do something like prompting the user for the data, or allow the user to put the data on the command line, or something like that.
So, to hard code the location of the file as being on the C: drive, you would just put the pathname of the file all together in your source code.
Here is an example.
int main()
{
const char *filename = “C:\myfile.txt”;
printf(“Filename is: %sn”, filename);
}
The file name is “hard coded” as: C:myfile.txt
The reason the backslash is doubled is because backslashes are special in C strings.
“Hard Coding” means something that you want to embeded with your program or any project that can not be changed directly.
For example if you are using a database server, then you must hardcode to connect your database with your project and that can not be changed by user.
Because you have hard coded.