cmd command with c

To execute a command in C, you can use the system() function from the stdlib.h library. The system() function takes a string as an argument, which represents the command you want to execute. Here is an example of how to use the system() function to execute a command in C:

#include <stdlib.h>

int main() {
    system("command_here");
    return 0;
}

Replace "command_here" with the actual command you want to execute. For example, if you want to execute the "dir" command on Windows, the code would be:

#include <stdlib.h>

int main() {
    system("dir");
    return 0;
}

When you run this program, it will execute the "dir" command, which lists the files and directories in the current directory.