create account

Learning C Programming Language - 1 by leo32

View this thread on: hive.blogpeakd.comecency.com
· @leo32 · (edited)
Learning C Programming Language - 1
<center>![image](https://images.ecency.com/DQmZA1x7qRj1fmHFqxoJ2vnrhyq2GEoY4EGpt6EcowwVYpy/image.png)
[Source Image]()
</center>
Hi, today I want to talk about C language. In this post, I want to explain the structure and method of programming with this language so that in the end you will be able to understand and write simple programs.
<h1>Structure</h1>
The first step in learning any language is to learn and understand the structure of the programs in that language. The general structure of a program in C is as follows.

<code>
#include <stdio.h>
int main() {
  printf("Hello World!");
  return 0;
}
</code>
The first thing we do is add libraries to the program. These libraries contain functions or methods that work for us. You don't need to know what is going on behind the scenes, you are just requesting the action you want using the functions or methods inside these libraries and classes.
To join any library, you only need to write the following line of code.

<code>#include <yourlibrary.h></code>

You can add as many libraries as you want at the beginning of the code, one after the other, with this command.

<code>#include <yourlibrary1.h></code>
<code>#include <yourlibrary2.h></code>
<code>#include <yourlibrary3.h></code>
<code>#include <yourlibrary4.h></code>

Here, because we want to display a message to the user on the screen, our function is printf() which is in the library stdio.h . So we have to paste this library at the beginning of the code first.
In this case, the compiler will refer to this library and the definition of this function of the program will be pasted, otherwise, in the absence of this library, an error will be issued and your program will not run.

In C language, we have a function called main() that is your main function. All your programs should be written in this function.
When the compiler sees this function, it executes everything inside it, and its absence means that your program will not run.

Rules:
1. C Compiler is case-sensitive.
2. All commands end in ;
3. The body of the program / function starts with { And ends with }

return 0 ends the main() function.
properties (22)
authorleo32
permlinklearning-c-programming-language-1
categoryhive-169321
json_metadata"{"image":["https://images.ecency.com/DQmZA1x7qRj1fmHFqxoJ2vnrhyq2GEoY4EGpt6EcowwVYpy/image.png"],"tags":["hive-169321","c","leofinance","programming","learning"],"description":"Hi, today I want to talk about C language. In this post, I want to explain the structure and method of programming with this language so that in the end you will be able to understand and write simple","app":"ecency/3.0.23-vision","format":"markdown+html","thumbnails":["https://images.ecency.com/DQmZA1x7qRj1fmHFqxoJ2vnrhyq2GEoY4EGpt6EcowwVYpy/image.png"]}"
created2022-06-23 07:55:00
last_update2022-06-23 07:58:18
depth0
children4
last_payout2022-06-30 07:55:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,130
author_reputation386,124,929,810
root_title"Learning C Programming Language - 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id114,262,739
net_rshares0
@godofwar35 ·
!LUV
properties (22)
authorgodofwar35
permlink5,974,004,539
categoryhive-169321
json_metadata""
created2023-03-27 05:37:24
last_update2023-03-27 05:37:24
depth1
children0
last_payout2023-04-03 05:37:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4
author_reputation-6,774,839,269
root_title"Learning C Programming Language - 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id122,000,631
net_rshares0
@hivebuzz ·
Congratulations @leo32! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@leo32/replies.png?202303270607"></td><td>You got more than 10 replies.<br>Your next target is to reach 50 replies.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@leo32) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out our last posts:**
<table><tr><td><a href="/hive-122221/@hivebuzz/pud-202304"><img src="https://images.hive.blog/64x128/https://i.imgur.com/805FIIt.jpg"></a></td><td><a href="/hive-122221/@hivebuzz/pud-202304">Hive Power Up Day - April 1st 2023</a></td></tr><tr><td><a href="/hivebuzz/@hivebuzz/birthday-7"><img src="https://images.hive.blog/64x128/https://i.imgur.com/OaAR9Cj.png"></a></td><td><a href="/hivebuzz/@hivebuzz/birthday-7">Happy Birthday to the Hive Community</a></td></tr><tr><td><a href="/hive-139531/@hivebuzz/proposal-2324"><img src="https://images.hive.blog/64x128/https://i.imgur.com/RNIZ1N6.png"></a></td><td><a href="/hive-139531/@hivebuzz/proposal-2324">The Hive Gamification Proposal</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22248%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/248)!
properties (22)
authorhivebuzz
permlinknotify-leo32-20230327t061102
categoryhive-169321
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-03-27 06:11:03
last_update2023-03-27 06:11:03
depth1
children0
last_payout2023-04-03 06:11:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,544
author_reputation369,382,795,398,909
root_title"Learning C Programming Language - 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id122,001,193
net_rshares0
@lara76 ·
!LUV
properties (22)
authorlara76
permlink9,976,593,217
categoryhive-169321
json_metadata""
created2023-03-27 18:07:24
last_update2023-03-27 18:07:24
depth1
children0
last_payout2023-04-03 18:07:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4
author_reputation-6,774,839,269
root_title"Learning C Programming Language - 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id122,014,858
net_rshares0
@pars.team ·
!LUV
properties (22)
authorpars.team
permlink2,948,735,857
categoryhive-169321
json_metadata""
created2023-03-27 05:32:54
last_update2023-03-27 05:32:54
depth1
children0
last_payout2023-04-03 05:32:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4
author_reputation1,044,473,769,173
root_title"Learning C Programming Language - 1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id122,000,539
net_rshares0