网络技术

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; }

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

  1. 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.

  2. 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!

  3. 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.

  4. 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

  5. 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.

  6. 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!

  7. 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!!

  8. 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

  9. 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.

  10. Wow, superb weblog structure! How lengthy have you been running a blog for?
    you make running a blog glance easy. The whole glance of your web
    site is fantastic, as well as the content!

发表评论

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

答案 : *
24 − 7 =


返回顶部