Sunday, April 26, 2020

C chapter-2. How to write simple c program by using code blocks.



First open your code blocks IDE.
File->new project.
Dbl click console application
Next select c from the list.
Click next and give name to your project.for example “helloworld”
Click next select Gnu Gcc compiler in the list
Click finish
Next from left side under helloworld project expand “sources”
Dbl click main.c.




#include <stdio.h>
int main()
{
    printf("Hello world!\n");
    return 0;
}

Main() is the function which will be executed first. In any language main function would be the first to be executed. Printf() is a function used to display message passed to it on the console. We mention main as int main because it returns 0 an integer value.
Stdio.h is a header file. Usually header files contains library functions. Stdio.h contains printf(),scanf() functions. So we must import to our program to execute printf()   function. #include is used to import library functions.
Output



Thank you
Muthu karthikeyan, Madurai.
contact :91 96293 29142
please visit :youtube channel programming digest
 
\

No comments:

Post a Comment