Programming in C language: hello world)

Source: Internet
Author: User

Through practical practice, I will talk about C language and programming. These are two main contents of the series of articles.

I. Thinking Before school

From today on, I will talk about programming step by step based on my ideas. Maybe my thoughts are not the same as yours. It's not surprising that everyone has their own practices and ideas. I have never preached in a book, but I am not talking about it casually. I am still systematic, targeted, and present my views on programming to you. Don't reject new attempts or try to hear other people's ideas. Maybe there will be some gains.

I would like to ask readers, when you want to learn a new language, what should you consider first? How should you learn? How can you calculate and learn well ?. Will you consider these issues? If you never think about these issues and do not know how to think about them, I will tell you to learn to think about them in the first lesson. A programmer is not a good programmer if he is not good at thinking. Remember to learn to think and get used to it if he is not used to thinking.

How to think? What do you think? To learn a language, you must first consider learning a language as a whole. I have to think about it before learning. Why? How to Learn? What do you learn? How long does it take? To what extent?

Many programmers are eager to compile the program, to see the results of the program running, or to learn and do everything as they do, because they have not considered these issues well, after a few years, I don't know what I learned. These are what I do not want to see.

1,Why?

I think this problem must begin with pragmatism and be useful. For example, job needs, job needs, and project needs. In short, if it can bring economic benefits in the near future, you can consider learning. Do not waste time learning out of curiosity, upgrades, popularity, new products, or technology. If you want to be interested, you need to consider it. You can consider one or two useful programming languages to learn.People have little time, and programmers have little time and are precious.

2,How to Learn?

I have seen that most people are looking for a book. They should read it first and try again. If they do not know how to search for it online, they will learn from books and learn from the Internet. This method must be learned by an average programmer. What I advocate is not to read books (I mentioned this method in "Programmer growth roadmap: from entry to excellence. By learning from others, you can speed up the learning process, find the learning focus, and avoid unnecessary self-checking the cause of errors for a long time. More importantly, you can cultivate the awareness of the programmer team, through communication with others, learn from each other and make progress together. Some students say, "I am looking for someone who can't program. Who should I learn ?" I can only say that there are a lot of people who will program now, as long as you find it with your heart, you will find it. As for whether people will teach you, it depends on you.

3,What do you learn?

A language is like a sea, and you don't know how big the sea is, how deep it is, so if we drink just a few mouthfuls of sea water like we do. Therefore, it is more important for us to master the method of drinking sea water, rather than drinking those sea water. It is hard to say what people learn, because they face the boundless sea water. I pay more attention to methods. I have summarized the following points:

1) language environment Installation

2) edit the source program

3) Compile the source program

4) run the program

5) language syntax

6) debugging

7) Language Architecture

8) important system calls and references in languages

9) create a package and installation program

I hope that after all the articles are published, I can list them into a table for easy memory and learning. Other details can be ignored.

4,How long does it take?

The duration of learning varies from person to person. Some people have a better foundation, more experience, and more brains. Some people bring some knowledge to learn faster. Some people, on the contrary, are slower. In general, one month to two months can be good.

5,Degree of Learning

There is no end to language learning. You cannot learn it for 2 years or 10 years. I still advocate practicality. Only after learning can I meet the requirements of my work, so I can come up with a paragraph. In the future, you can study at random and accumulate at work.

 

Some netizens may not pay much attention to the problems they want to think about. They feel that they need to consider these things when learning programs. Learning programming means learning grammar and calling. Based on years of experience, I think the syntax, functions, and calls of the language itself are not very important. It is a dead thing and cannot be run. Learning to think and learning to learn programming from the process is the top priority.

 

II,Hello worldProgramming

Okay, let's talk about it again. You may beat me down. I will tell you about my C language environment this time.:AIXOperating System,ORACLEDatabase.AIX can be viewed as a traditional UNIX environment and is for command line editing, compilation, and running (not for windows ). In fact, the C language environments vary widely. You can make appropriate adjustments based on your own environment. If you have prepared the C language environment, we can start the C language practice.

I still cannot be vulgar, or take care of friends eager to see C language programs and start my helloworld programming.

I useViEdited the helloworld program a. c, compiled, and run it.

The process is as follows:

1,EditA. c

1. Type

Vi a. c

2. edit a. c.

# Include "stdio. h"

Main ()

{

Fprintf (stdout, "hello world! \ N ");

Exit (0 );

}

2,CompileA. c

Type

Cc A.C

3,RunA. out

Type

./A. out

4,Display result

Hello world!

 

Okay. The first C language program was compiled and run. You can also try it. C language.

Next we will think about this program:

1. This program has simple functions. However, you should not focus on the functions of the program. It is placed on the process of a language. Remember that the process is:1Edit2, Compilation,3, Run.

2. You have noticed that my source program name is a. c instead of helloworld. c. This is related to the name of the source program.

3. the executable file without this program is named a.out, but not a.exe or.

This is also worth talking about. This is related to compilation. We will discuss it in detail during compilation.

4. No. When you run this program, a./is added before a. out ./. This is also a skill. Sometimes, you can see that the executable file in the directory is another file. This ensures that the executable files in the current directory are executed. When the operating system accepts the command line command, it will find the file in the order of the command path, and the current directory is usually placed after the bin directory. The command path is placed in the path environment variable.

5. Let's talk about every program in A.C next time. The focus is on the process. I hope you will remember what we learned at school:1Edit2, Compilation,3, Run

 

In short, through this article, if you remember what the programmer wantsThoughtsTo learn why? How to Learn? What do you learn? How long does it take? To what extent? Keep in mind the programming process: 1. Edit 2. Compile, 3. Run the program even if it passes. I emphasize the basics of programming, the principles, and the knowledge of programming. Don't worry about programming. Take it easy. Overcome your spontaneous desire to take it for granted, overcome the impulse Based on programming, think more, and think more. In this way, you can have a solid foundation for programming, your future programming skills can be greatly improved.

Appendix: I opened a technical microblog named "EOM and programmer's house" on Sina Weibo, recording my daily technical experiences, ideas, and programming, I hope you will pay attention to and communicate with us. Http://weibo.com/2311619842

<Script type = text/javascript> if ($! = JQuery) {$ = jQuery. noConflict ();} var isLogined = false; var cb_blogId = 30363; var cb_entryId = 2214555; var cb_blogApp = "n216"; var cb_blogUserGuid = "a4823d0b-63cf-dd11-9e4d-001cf0cd104b "; var cb_entryCreatedDate = '2017/17 8:54:00 '; </script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.