Loading...
Loading...
00:00:00

Write First Program in C language

Hello World Program In C

To compile and run a C language program, you will need a C compiler installed on your system. Here are the general steps to compile and run a C program:

  • Write your C program in a text editor or an Integrated Development Environment (IDE). The program should have a .c file extension, for example, hello.c.

  • Open a command prompt or terminal window and navigate to the directory where the C program file is located.

  • Compile the C program using a C compiler.  To do this, follow these steps 

Let's write First program in C language and Run. Here is "Hello World" program -

  • First Open codeblocks (any source code editor)
  • Create New file
  • Save As
  • Filename.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{
    printf("Hello World");
    return 0;
}

Run C Program Using CMD

Follow these step to Run C program using Command prompt -

  1. open CMD and locate directory where c program file is available.
  2. write gcc filename.c -o filename.c hit enter
  3. Run filename.exe hit enter
    Run C Program in CMD
    Run C Program in CMD