Detail post of C Programming | How to write a basic c program? | Execute C program.

avatar
(Edited)

Beginning of a C program

A C program starts with its structure, that some people have problem in understanding the basic structure, but after some time it is easily understood that the first in its basic structure is the header file which defines that it Where the code is being saved, then there is the main function from which the programming starts in which we write the code and take its return value and the code gets executed.

Difference-between-ANSI-C-and-C-Programming-Language-750x375.jpg

src

Header Files Inclusion

stddef.h – Defines several useful types and macros.
stdint.h – Defines exact width integer types.
stdio.h – Defines core input and output functions
stdlib.h – Defines numeric conversion functions, pseudo-random network generator, memory allocation
string.h – Defines string handling functions
math.h – Defines common mathematical functions

Main Method Declaration

What is the main function that declares the syntax of the program and from this the programming starts.

int main()
{}

Variable Declaration

After that we define the variables, we use these variables to store data in the program, whatever value we keep in these variables according to their property, we can use it at the time of writing the code.

int main()
{
int a;

here are different type of variable we can use "int , float, char, double, etc,"

Body

The body of a function in the C program, refers to the operations that are performed in the functions. It can be anything like manipulations, searching, sorting, printing, etc.

int main()
{
int a;
printf("%d", a);
.
.

Return Statement

The last part of any C program is the return statement. The return statement refers to the returning of the values from a function. This return statement and return value depend upon the return type of the function. For example, if the return type is void, then there will be no return statement. In any other case, there will be a return statement and the return value will be of the type of the specified return type.

int main()
{
int a;
printf("%d", a);
return 0;
}

First c program

#include <stdio.h>
int main( )
{
printf("Hello World");
return 0;
}

first post of C programming.-> link

Thank You for supporting this post..............

Posted with STEMGeeks



0
0
0.000
9 comments
avatar

This is a nice intro into c/c++ programming.
I would love to see some interesting application in your next posts. :)

!PIZZA

0
0
0.000
avatar

Thank you brother, I will try my best.

0
0
0.000
avatar

Let's make programming more interesting. 🙂
I'll also try to make a simple tutorial with some basic application.

0
0
0.000
avatar
Don-1UP-Cheers-Cartel-250px.png

You have received a 1UP from @luizeba!

The following @oneup-cartel family members will soon upvote your post:
@stem-curator, @vyb-curator, @pob-curator, @neoxag-curator
And they will bring !PIZZA 🍕

Learn more about our delegation service to earn daily rewards. Join the family on Discord.

0
0
0.000
avatar

Nice post man! In my opinion, it is really helpful for people who are just getting started with the C programming language. I would add a new line character on printf function in the First c program section, but it doesn't really matter. : )

0
0
0.000