What is the syntax for compiling a C program using GCC?

QuestionsQuestions8 SkillsProCreate "Hello World" In COct, 08 2025
0118

To compile a C program using GCC, you can use the following syntax in the terminal:

gcc filename.c -o outputname
  • filename.c is the name of your C source file.
  • -o outputname specifies the name of the output executable file. If you omit this option, the default output file will be named a.out.

For example, to compile a file named user_input.c and create an executable named user_input, you would use:

gcc user_input.c -o user_input

0 Comments

no data
Be the first to share your comment!