网络技术

C语言入门第一章(主函数、格式输出函数、注释代码)

开始第一个C语言程序

/*闲得无聊水文章*/

主函数

一个C程序有且只有一个主函数,即main函数。C程序就是执行主函数里的代码,也可以说这个主函数就是C语言中的唯一入口。

这个道理就好比每个电梯只有一扇门,要想乘坐电梯的话就必须从这扇门进入;而main前面的int就是主函数的类型,好比乘坐的这个电梯是什么材料做的。

格式输出函数

printf()是格式输出函数,这里就记住它的功能就是在屏幕上输出指定的信息。

示例代码(主函数、输出)

#include <stdio.h> 
int main()
{ 
printf("C语言入门到入狱");
return 0; }

注释代码

注释代码是给人看的,方便了解到每段代码写的是什么内容,在要修改和维护的时候,可以通过查找中文就准确定位。也可以通过正则搜索,快速预览到整体的代码结构。

注释的代码在运行时会被绕过。

示例代码(注释)

/*<>
*注释的代码不会被执行
*注释的代码不宜太多
*可以写日期、时间、作者、版权、内容
*/
#include <stdio.h> /*这里是主函数入口*/
int main()
{ 
printf("C语言入门到入狱");
return 0; }

99 thoughts on “C语言入门第一章(主函数、格式输出函数、注释代码)

  1. Excellent post. I was checking continuously this blog and I am
    impressed! Very useful info specially the last part 🙂 I care
    for such info a lot. I was seeking this particular info for
    a very long time. Thank you and best of luck.

  2. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is
    added I get three e-mails with the same comment.

    Is there any way you can remove me from that service? Cheers!

  3. Hey! This post couldn’t be written any better! Reading this post reminds me
    of my good old room mate! He always kept chatting about this.
    I will forward this page to him. Fairly certain he will have a good read.

    Thank you for sharing!

  4. Every weekend i used to pay a visit this web page,
    for the reason that i wish for enjoyment, for the reason that this this web site conations
    genuinely nice funny data too.

  5. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is valuable and everything. However just imagine if you
    added some great images or video clips to give your posts
    more, “pop”! Your content is excellent but with pics and videos, this blog could
    definitely be one of the best in its field. Wonderful blog!

  6. My brother suggested I may like this web site. He was totally right.
    This publish actually made my day. You can not believe simply
    how much time I had spent for this information! Thanks!

  7. What i do not realize is in fact how you’re no longer actually much more neatly-preferred than you may be right now.
    You’re so intelligent. You recognize therefore
    significantly when it comes to this topic, produced me individually imagine it from a lot of
    varied angles. Its like women and men don’t seem to be involved unless it’s one
    thing to accomplish with Girl gaga! Your personal stuffs great.
    Always care for it up!

  8. I’m amazed, I must say. Seldom do I come across a blog that’s both
    equally educative and engaging, and without a doubt, you’ve hit the nail on the head.
    The problem is an issue that too few men and women are speaking intelligently about.
    Now i’m very happy I stumbled across this during my hunt for something regarding
    this.

  9. Good day very nice blog!! Guy .. Beautiful .. Amazing ..
    I will bookmark your website and take the feeds also?
    I’m satisfied to search out so many useful info here in the post, we need work out more strategies on this regard,
    thank you for sharing. . . . . .

  10. Wow, marvelous weblog format! How lengthy have you been running a blog for?
    you make blogging look easy. The entire glance of your web site is magnificent, let
    alone the content material!

  11. I am not sure where you are getting your information, but
    great topic. I needs to spend some time learning much more or understanding more.
    Thanks for excellent information I was looking for
    this information for my mission.

  12. Right here is the perfect website for everyone who hopes to understand this topic.
    You understand a whole lot its almost tough to argue with you (not that I really will need to…HaHa).
    You certainly put a new spin on a subject that has been written about for decades.
    Great stuff, just excellent!

  13. After exploring a few of the blog posts on your site, I truly appreciate your technique of
    blogging. I saved as a favorite it to my bookmark website list and will
    be checking back in the near future. Please check out my web
    site as well and let me know your opinion.

  14. You actually make it seem so easy with your presentation but I find this matter to be
    actually something which I think I would never understand.

    It seems too complicated and extremely broad for me.
    I’m looking forward for your next post, I’ll try to get the hang of
    it!

  15. hi!,I like your writing so so much! proportion we communicate
    extra about your article on AOL? I need a specialist on this house to unravel my problem.
    May be that is you! Having a look forward to look you.

  16. Wonderful beat ! I wish to apprentice while you amend your website, how can i subscribe
    for a blog site? The account helped me a acceptable deal.

    I had been tiny bit acquainted of this your broadcast provided bright clear
    concept

  17. Hello! Someone in my Facebook group shared this site with
    us so I came to check it out. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers!
    Superb blog and outstanding style and design.

  18. Hey! I know this is somewhat off-topic however I had to ask.

    Does operating a well-established website such as yours take a large amount of work?

    I am brand new to blogging however I do write in my diary daily.
    I’d like to start a blog so I can easily share my personal experience and thoughts
    online. Please let me know if you have any suggestions or tips for brand new aspiring bloggers.
    Thankyou!

  19. Hi, i think that i noticed you visited my weblog
    thus i got here to return the choose?.I’m attempting to find things to improve my website!I assume its good enough to make use of
    a few of your concepts!!

  20. Great beat ! I would like to apprentice at the same time as you amend
    your site, how could i subscribe for a weblog website? The account helped
    me a applicable deal. I had been a little bit familiar of this your broadcast provided
    bright transparent idea

  21. I was very pleased to discover this site. I want to
    to thank you for ones time for this particularly wonderful
    read!! I definitely loved every bit of it and i also have you bookmarked
    to look at new stuff in your website.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

答案 : *
29 + 14 =


返回顶部