Q:

Is there any way to change directory using C language?

Is there any way by which I can change to any directory by executing a C program?

A:

The chdir() function. For more info, use man chdir.

A:

Depending on your OS there are different calls for changing the current directory. These will normally only change the current dir of the process running the executable. After the process exits you will be in the directory you started in.

A:

chdir() changes only the current working directory of the process but not of the context in which you are working. Suppose you execute a program in the terminal and your current directory is /home/Documents, then on executing a program having the following lines
chdir("cd ../Downloads");

will not change the working directory of the terminal, but changes that of the process only.

