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

C语言入门第一章(主函数、格式输出函数、注释代码)》有17个想法

  1. Pretty great post. I simply stumbled upon your weblog and wished to mention that
    I’ve truly loved browsing your weblog posts.
    After all I’ll be subscribing in your rss feed and I am hoping you write once more very soon!

  2. wonderful submit, very informative. I’m wondering why the other specialists of this sector don’t understand this.
    You must continue your writing. I’m confident, you have a
    great readers’ base already!

  3. Hi just wanted to give you a brief heads up and let you know a few of the
    pictures aren’t loading properly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different web browsers and both show the same outcome.

  4. An outstanding share! I have just forwarded this onto a coworker who was
    conducting a little homework on this. And he actually bought me dinner due to the fact that I found it for him…
    lol. So allow me to reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending time to talk
    about this matter here on your blog.

  5. Howdy just wanted to give you a brief heads up and let you know
    a few of the pictures aren’t loading properly. I’m not sure why but I think its a
    linking issue. I’ve tried it in two different web browsers and both show the same results.

  6. Hello! I could have sworn I’ve been to this site before but
    after checking through some of the post I realized it’s new
    to me. Anyhow, I’m definitely delighted I found it and I’ll be book-marking
    and checking back often!

  7. Heya! I understand this is kind of off-topic however I needed to ask.
    Does managing a well-established blog such as yours require a lot of work?

    I’m brand new to running a blog however I do write in my journal daily.
    I’d like to start a blog so I can share my personal experience and views
    online. Please let me know if you have any kind of recommendations
    or tips for new aspiring bloggers. Thankyou!

  8. Can I simply say what a relief to find someone that truly knows what they
    are discussing on the net. You definitely understand how to bring a problem to light and make
    it important. More people need to read this and understand this
    side of your story. I was surprised you’re not more popular given that you most certainly have the
    gift.

  9. I’d like to thank you for the efforts you have put in penning this website.
    I am hoping to view the same high-grade content by you in the future as well.
    In fact, your creative writing abilities has motivated me
    to get my own, personal website now 😉

发表评论

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

答案 : *
14 − 5 =