Compile and Execute C Program
Compile and Execute C Program
This tutorial will teach the steps to compile & execute the C Program on the Windows operating system.
Setup Environment
Setup C programming environment. Install C compiler and text editor like Notepad++.
Create Source Code File
Open a text editor and add the C code.
Save the file with the *.c file extension. For example, ‘helloworld.c’ file.
C Code
/**
**********************************
* Program Description:
* C Hello World Program
* Filename : helloworld.c
* Author : TestingDocs
* Date : 02/03/2017
* C Tutorials – www.TestingDocs.com
*************************************
*/
#include<stdio.h>
int main()
{
/* C Hello World Program
using Text Editor and command line
On Windows 10 operating system.
*/
printf(“Hello, World! \n”); // print message
return 0;
} // end main
Compile C Program
Open a command prompt and issue the following command to compile the code:
\> gcc <filename.c>
\> gcc helloworld.c
Execute C Program
If there are no errors in the code, an executable file will be generated ( a.exe )
Type the following command to execute the C program.
\> a.exe
That’s it. We have successfully complied and executed a sample C program on Windows operating system using the command line prompt.
—
C Tutorials
C Tutorials on this website can be found at: