Related questions

BJSHUB - is a place to gain and share knowledge. It's a platform to ask questions and connect with people who contribute unique insights and quality answers.

How to compile and execute C program

0 votes
asked Apr 20, 2017 in C program by anonymous

1 Answer

0 votes

Now you will understand steps to compile and run C program. You will also learn how to save source code in file. In addition steps for compiling and running program are here.

Steps to compile and run C program using gcc

  • Firstly, you must open text editor
  • Secondly, add code
  • Next you must save the file with name.c (here name is your file name)
  • After this you must open command prompt
  • From there go to directory (this is where you saved file)
  • Later type gcc name.c
  • Press enter as this will compile code
  • However, in case of errors in code, command prompt takes you to next line
  • It will then generate a.out executable file
  • You must remember that you type a.out
  • Because this will only execute your program
  • Finally, you can check output on screen

Points to remember

You must see that GCC compiler is in path. In addition, you must run it in directory. This directory should have source file. Moreover, this source file is name.c

So, you understood C program structure functions. You also learnt how to compile and execute C program using gcc. Moreover, we clearly stated C program structure example. It is better that you check examples for compile and run C program online.

answered Apr 20, 2017 by anonymous
...