The command system() creates a new process to handle the specified command.
char cmd[10];
strcpy(cmd, "dir");
system(cmd);
In most cases, this is neither performant nor useful. But of course you can start a process with C this way. You could also redirect the output to a file and then read this file again. More performant and without needing a file you can realize this by using system calls. The effort is not insignificant, since you have to redirect inputs and outputs to a pipe before starting the process instead of simply system(). While on Unix you would use a combination on fork(), pipe() and exec() this could be solved as follows on Windows:
Creating a Child Process with Redirected Input and Output
https://learn.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output
If you only want to get the contents of a directory, you can use the combination of FindFirstFile() and FindNextFile().
Listing the Files in a Directory
https://learn.microsoft.com/en-us/windows/win32/fileio/listing-the-files-in-a-directory