How do I execute a .c file?

前端 未结 1 1544
情深已故
情深已故 2021-01-26 13:48

I have a .c file with a program (obviously written in C):

#include 

int main(int argc, char** argv) {
  printf(\"Hello World\\n\");         


        
相关标签:
1条回答
  • 2021-01-26 14:15

    You cannot execute an file ".c" from shell. You must compile it first.

    For example: We have an file called "file.c"

    1. Open a terminal
    2. Use gcc for compile the file and make an executable (gcc file.c -o executable)
    3. Now you can open the executable file since shell (just go to the folder and execute ./executable
    0 讨论(0)
提交回复
热议问题