Clion compiles and runs a single C / cpp file

C/CPP is all right, but you need to create a new project first. You can only have one main at a time, so you need to be able to let it compile and execute a single file
Installing a plug-in

in the Settings to find the plug-in installation, after the completion of the open folder, you first create a new Cmakelist files, and right click on the need to perform the c file

choose the bottom of the add, you will see the main function on the left side of a small arrow, direct execution

Read More: