1. 程式人生 > >C語言第一節

C語言第一節

這篇文章首發自我的微信公眾號(Mark學程式設計),特此說明。
測試感覺OK了,這個公眾號可以開始工作了,當然,關注的人太少,需要積極推廣。
從今天開始,基本上每天會有程式設計的內容釋出,初步打算是C語言開始,後面有Python, 然後可能是Php或Java等。歡迎讀者反饋,便於安排。
C語言的學習主要是以雙語版的《C程式設計》一書為主要讀本,配合兩本輔助的讀物,一本叫做《明解C語言》看上去是很好的讀物,一本是大學教材《C程式設計》,譚浩強編寫的。用的編譯軟體是在WIN10上面使用的DEV-C++,當然,讀者可以用自己喜歡的編譯軟體。順便說一句,安裝編譯環境是第一個考驗,不要氣餒,有問題,可以參考網上資料,或者反饋作公眾號,一定會得到好的解決。

下面我用英語,主要是從雙語版改寫而來,簡單介紹C語言。
The C programming language was developed in1972 in USA. You know The US is the super power country which also is the leading country in the Computer Science. The American National Standard Institute (ANSI) developed the first standardised specification for the language. namely C89. And now we know we  use the C99, which was further revised in 1999 based on the previous one.
Why C language? There are a lot of reasons. In the book the author list 6 advantages of it. i.e: A: Portable which means C can run on different computer system. B: It is a structured language. C: efficient which means runs fast. D: flexible the author list a lot which suggest the C can do a bunch of jobs. E: powerful. It can manipulate the computer memory for example.  and F: C is concise. OK, that is the point of view in the author's mind. Anyway, as far as I know. C is the starting point for the programmers to start with. And I also think it is a fundamental for people to begin his/her understanding of the program.

Let's start to write a simple program which say hello to verery body. And before that, I would like to to remind you that the 7 steps of the running the C program.

Step 1: Define the problem(task). Here we will run a program which can print “Hello Everyone”.

Step 2: Design algorithm to solve the problem( to carry on the task). print a phrase is easy in the C. We just use "printf" function.

Step 3: Design the program. again we use printf function.

Step 4: Write the code. We call the output of our writing code "Source File"

Step 5: Compile the source file. The outcome we name it object file.

Step 6: Link the object file. the executable file generated.

Step 7: Run the executable file. Finnaly the result. 

I will paste the code in my Dev-C++ in the below and will show you how the steps going on.