Search This Blog

About Me

My photo
Hello, my name is Gurnoor Singh. I am the creator of NoorEDU, a blog for about education . I live in India. I study in BCA Trade.In my free time, I enjoy hiking, practicing photography, and exploring the city by bike.

Wednesday 23 September 2020

First Program in C Language

 First Program in C Language 

Before starting the abcd of C language, you need to learn how to write, compile and run the first c program.

To write the first c program, open the C console and write the following code:

  1. #include <stdio.h>    
  2. int main(){    
  3. printf("Hello C Language");    
  4. return 0;   
  5. }  

#include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .

int main() The main() function is the entry point of every program in c language.

printf() The printf() function is used to print data on the console.

return 0 The return 0 statement, returns execution status to the OS. The 0 value is used for successful execution and 1 for unsuccessful execution.

How to compile and run the c program

There are 2 ways to compile and run the c program, by menu and by shortcut.

By menu

Now click on the compile menu then compile sub menu to compile the c program.

Then click on the run menu then run sub menu to run the c program.

By shortcut

Or, press ctrl+f9 keys compile and run the program directly.

You will see the following output on user screen.

c program output

You can view the user screen any time by pressing the alt+f5 keys.

Now press Esc to return to the turbo c++ console.

0 comments:

Post a Comment

Bitwise Operator in C