What do the commands 'gcc test.c -o test' and './test' do?

QuestionsQuestions8 SkillsProCreate "Hello World" In CNov, 02 2025
0100

The commands perform the following actions:

  1. gcc test.c -o test:

    • This command compiles the C source file named test.c using the GCC compiler.
    • The -o test option specifies that the output executable should be named test. If this option is not provided, the default output name would be a.out.
    • After running this command, if there are no errors in the source code, an executable file named test will be created.
  2. ./test:

    • This command runs the compiled executable named test.
    • The ./ indicates that the executable is located in the current directory.

In summary, the first command compiles the C program, and the second command executes the compiled program.

0 Comments

no data
Be the first to share your comment!