We have already introduced iOS Develop some basic knowledge , Actually iOS Development is development iPhone\iPad Software on , And to develop a piece of software , The first thing to learn is programming language .iOS Development needs to learn the main programming languages are :C Language 、C++、Objective-C, among C++、Objective-C It's all about C Language is the foundation , from C Language is derived from . Let's start with this , Let's put it away for a while iOS Relevant knowledge , Sink down to learn the legendary C Language . Before formal study , Let me remind you first : Learning the grammar of a language is boring , It's like learning 1+1 Equal to several , It's impossible to say , Study C In the process of language grammar, we can immediately make some good-looking iPhone Interface effect . Everyone should be calm , The so-called hard work is sweet , There is no accumulation of grammar , How to write a nice interface ?

One 、 Computer knowledge

I'm learning C Before the language , First of all, I need to know something about computers

1. Computers can only recognize 0 and 1

  • Everybody knows , The computer needs electricity to work , To put it bluntly , It's like TV 、 Like a washing machine , It's all electrical . Electrical appliances have a common ability : Know how to judge power on or power off , You can work with electricity , Stop working when the power is off . therefore , Fundamentally speaking , Computers can only recognize electrical signals : High level signal ( Electrify )、 Low level signal ( power failure ), It only knows whether a switch is on or off . We use it 1 For high level ,0 For low level .
  • That is to say , Computers can only recognize 0 and 1.

2. Binary system

Because computers can only recognize 0 and 1, So all the instructions and data that a computer can recognize are binary numbers (0 and 1) To represent the . So called binary , Just use 0 and 1 To represent all the numbers . But the most commonly used system in our daily life is the decimal system , use 0~9 To represent all the numbers

1> Binary instructions

Give the computer instructions , It can do the right thing , And the computer can only recognize 0 and 1 Composed instructions . In the early days of computer development , The instruction length of the computer is 16, That is to 16 Binary number (0 or 1) Form a command , for example , use 1011011000000000 This Directive , Let the computer do an addition . therefore , If you want a computer to perform a series of operations , You have to write a lot of articles by 0 and 1 Composed instructions , As you can imagine , The workload is so huge .

2> binary data

Usually we store some data in the computer , Like documents 、 Photo 、 Video etc. , It's all about 0 and 1 Is stored in the form of . It's just that the computer parses a lot of 0 and 1, Display the data in the form of graphical interface before our eyes .

Two 、 The history of programming language

We can use programming language to write programs , And then run the program to the computer , The computer can do as the program says . Ever since the birth of computers , Programming languages have roughly experienced 3 Stages of development : machine language 、 assembly language 、 High-level language . among ,C Language is a high level language .

1. machine language

1>  What is machine language

In the early days of the calculator ,  All computer programs are written directly with binary instructions that the computer can recognize , That is to say, in all the code, only 0 and 1. This programming language is “ machine language ”. These are 0 and 1 Composed of binary instructions , Also known as “ Machine instructions ”

2> advantage

  • Because the code written by machine language can be directly recognized by computer , So machine language has a direct effect on hardware , The execution efficiency of the program is very high .
  • Machine language has direct access to 、 The various hardware devices that control the computer , Disk 、 Memory 、CPU、I/O Port, etc .

3> shortcoming

  • Write a program in machine language , Programmers should first memorize all the instructions of the computer they use and the meaning of the instructions , There are so many instructions and it's hard to remember .
  • The programs are all 0 and 1 The command code of , Poor readability , It's easy to make mistakes .
  • Because machine language works directly on hardware , It's very hardware dependent , Therefore, the machine language of different models of computers is different . in other words , If 2 Different models of machines want to achieve the same function , You need to write 2 A completely different code .

It can be seen that , Machine language is difficult to master and popularize , Now in addition to the professionals of computer manufacturers , Most programmers don't learn machine languages anymore .

2. assembly language

1> What is assembly language

  • Because of the disadvantages of machine language , Seriously affect development efficiency , Then came assembly language . Assembly language is actually symbolic machine language , It uses a symbol ( English words 、 Numbers ) To represent a machine command . such as , In machine language , use 1011011000000000 This Directive , Let the computer do an addition ; And in assembly language , In English words “ADD” You can say addition . A meaningful English word , It's obviously longer than a bunch of stinky binary instructions , It's intuitive and easy to remember .
  • Because computers can only recognize 0 and 1, Code written in assembly language cannot be recognized by computer , Like just now “ADD”, Computers certainly don't know what it means . therefore , Code written in assembly language needs to be translated into binary instructions , To be recognized by the computer . The job of translation is given to “ compiler ” To do .

2> advantage

  • Compared to machine language , Assembly language code readability is good
  • Assembly language can be like machine language , You can directly access 、 The various hardware devices that control the computer , Disk 、 Memory 、CPU、I/O Port, etc . Use assembly language , Access to all accessible software 、 Hardware resources .
  • Object code short ( Object code is binary code translated by compiler ), Less memory , Fast execution .( All programs in the computer run in memory , So the performance of memory has a huge impact on the computer . It is used for temporary storage CPU Operation data in , And data exchanged with external memory such as hard disk . As long as the computer is running ,CPU The data to be calculated will be transferred to memory for operation , When the operation is finished CPU And then transmit the results , The operation of memory also determines the stable operation of the computer .) The memory of a computer is limited , So the less memory an application uses when it runs, the better .

3> shortcoming

  • Assembly language is machine oriented , It is usually specially designed for a particular computer or series of computers . therefore , Different machines have different assembly language syntax and compilers , Code lacks portability , in other words , A program can only run on one machine , If you switch to another machine, it won't work .
  • There are many symbols in assembly language 、 Hard to remember , Even simple functions require a lot of assembly language code , Easy to produce BUG, It's hard to debug
  • Using assembly language requires a good understanding of hardware , Development efficiency is very low , The period is long and monotonous

3. High-level language

Because assembly language depends on hardware , Poor code portability , There are so many symbols and they are hard to remember , So human beings invented a high-level language which is very close to natural language . What to learn later C Language is high level language .

1> advantage

  • Simple 、 Easy to use 、 Easy to understand , Grammar and structure are similar to ordinary English , And away from the direct operation of hardware , So that ordinary people can program after learning , Instead of being too familiar with hardware
  • The program is more concise . For example, to calculate 2 The number and , It can be very concise in high-level language :d=a+b;. But in machine language and assembly language , It takes a few or even dozens of instructions , And different machines have to write different instruction codes
  • The same program written in high-level language can also run on different machines , It's portable

2> Be careful

Programs written in high-level languages cannot be directly recognized by computers , It needs to be translated into binary instructions by the compiler , To run on the computer

3、 ... and 、C A brief history of language

  • C Language in 1972 The invention of , First used to rewrite UINX operating system (UNIX It used to be written mainly in assembly language , It lays the foundation for the operating system )
  • With UNIX The success of the operating system ,C Language has also been greatly promoted , It has been used successively to big 、 in 、 Small 、 On the micro host , It's still the most popular in the world 、 One of the most widely used high-level programming languages
  • C Language is a process oriented language , Non object oriented languages .( What on earth is process oriented 、 object-oriented , I don't need to understand , Just need to know C Language is process oriented Ok 了 )

Here is 2013 year 3 Programming language hot list for the month

from C Since the birth of language , It's not getting any hotter , The top two are basically Java and C

Four 、C Characteristics of language

1. Rich operators

The basic function of a computer is to calculate , So the computing power of a programming language is very important .C Language provides 34 Operator , The types of computation are extremely rich , It includes the most basic operations of addition, subtraction, multiplication and division .

2. Rich data types

  • C How strong is the vitality of language , A lot of it is because it has rich data types .
  • It is because C Language data types are rich , It's very powerful , So many databases use C language-written , such as DB2、Oracle etc. .

3. You can operate the hardware directly

Just like assembly language ,C Language can operate hardware directly , Allow direct alignment 、 byte 、 Address operation ( position 、 byte 、 Address is the basic unit of work of a computer ), Almost none, so to speak C What language can't do .

4. Efficient object code

Object code , Is the binary code translated by the compiler .C The execution efficiency of object code is very high .

5. Good portability

Use... In an environment C A program written in a language , No change or slight change , It can be ported to a completely different environment to run .

All the above is C Advantages of language , It has a very obvious drawback : Grammar restrictions are not strict . This leads beginners to C Language grammar cannot be understood thoroughly , And in the development process will also bring a lot of easily overlooked problems .

5、 ... and 、C The function of language
  • because C Language has powerful data processing ability , And it allows direct access to memory addresses , Operate directly on hardware , So it's suitable for writing system software 、 Graph processing 、 Single chip program 、 Embedded system development is even used for scientific research .
  • A lot of game plug-ins are used C Written language
  • The bottom layer of many operating systems uses C Written language , such as android 

6、 ... and 、C The version of the language

from UNIX After the success of the operating system ,C Language is widely used , From mainframe to minicomputer , There are C Language is active , There are also many versions of C Language . Long past ,C Language will probably become a subject with many varieties 、 Loose language . A formal language , There must be a standard , Otherwise, it would be a mess . In order to change this situation ,1983 The National Bureau of standards (American National Standards Institute, abbreviation ANSI) A committee was set up , Start working on C Language standards work .1989 year C Language standards are approved , This version of C Language standards are often called ANSI C

Li Hongqiang iOS Development of zero basic learning iOS Development 】【02-C Language 】01- Overview of more related articles

  1. Li Hongqiang iOS Development of zero basic learning iOS Development 【02-C Language 】03- keyword 、 identifier 、 notes

    The first one was created in the last lecture C Language program , got it C A program is made up of functions , This is about continuing to learn C Some basic grammar of language .C Language belongs to a high level language , Actually , The basic grammatical components of all high-level languages are the same , It's just in a different way . It's like ...

  2. Li Hongqiang iOS Development of 【 Zero base learning iOS Development 】【01- Preface 】01- The opening

    Starting today , I started updating [ Zero base learning iOS Development ] This topic . Whether you've been involved or not IT field , And whether you're a science student or a liberal arts student , As long as you are right iOS Development interest , You can read this topic . I try to use easy to understand language , So that everyone can understand ...

  3. 【 Zero base learning iOS Development 】【 Reprint 】

    Original address :http://www.cnblogs.com/mjios/archive/2013/04/24/3039357.html Contents of this article One . What is? iOS Two . Mainstream mobile operating systems 3、 ... and . What is? iOS open ...

  4. 【 Zero base learning iOS Development 】【01- Preface 】01- The opening

    Contents of this article One . What is? iOS Two . Mainstream mobile operating systems 3、 ... and . What is? iOS Development Four . Study iOS The purpose of the development 5、 ... and . Study iOS The premise of development Starting today , I started updating [ Zero base learning iOS Development ] This topic . Whether you've been involved or not I ...

  5. Zero base learning iOS Development

    Zero base learning iOS Development, whether you've been there or not IT field , As long as you are right iOS Development interest , You can read this topic . [ Zero base learning iOS Development ][02-C Language ]11- Function declaration and definition Abstract : In the last lecture , This paper introduces the definition of function and how to make ...

  6. [iOS] About zero basic learning iOS Summary of learning methods developed

    About zero basic learning iOS Summary of learning methods developed Recently, many students who come to blue gull training from zero base often ask questions about learning methods , Let's discuss the following good learning methods I have seen myself . Blue gull iOS Learning roadmap of development technology The main job of a programmer is ...

  7. MongoDB Practical development 【 Zero base learning , Complete with Asp.net Example 】

    MongoDB Practical development [ Zero base learning , Complete with Asp.net Example ] Read the directory Start download MongoDB, And activate it stay C# Use MongoDB restructure ( simplify ) Code Use MongoDB Client view data for Use Mo ...

  8. Zero base learning hadoop There are three basic knowledge needed for development

    big data hadoop It is undoubtedly one of the most popular words in the current Internet field , The application of big data technology is imperceptibly changing our life and work . This change gives us the feeling that “ When water flows, a channel is formed ”, What's more amazing is that big data is just the Internet ...

  9. Li Hongqiang iOS Development of 【 Zero base learning iOS Development 】【01- Preface 】02- Get ready

    In the last lecture , Introduced what is iOS Development . To be simple ,iOS Development , It's development running on iPhone perhaps iPad Software on . After that , There should be a lot of people who have doubts , Like learning iOS Development is not necessarily to buy iPhone? Need not ...

Random recommendation

  1. iOS Two of them ImageView Achieve picture scrolling

    Original author :codingZero Introduction In many projects , There will be a picture carousel function , Now there are many frames about picture rotation on the Internet , all sorts of strange things , According to my own thinking , With two imageView Also realized the picture carousel , Here is my main idea ...

  2. Java MyEclipse Next Ant build.xml Detailed explanation of simple examples

    One . Download configuration ant 1. First download ant: http://www.apache.org/  Download the latest version 2. decompression ant After setting ANT_HOME, PATH Add ANT_HOME In the catalog bin Catalog ( Such as :A ...

  3. JavaScript Template engine realizes data interaction

    after 1 Years of discipline , Recently, I finally realized that , How does the front end meet the requirements of the enterprise : Data interaction . 1,ajax+json This is something we have to learn , But no problem , We can learn more about it through this blog ? 2, Can pass JS The framework and JS Template ...

  4. stay ThinkPHP3.x In the framework, the original articles are pushed to Baidu for collection at the first time

    I wrote an article two days ago “ in the light of BootStrap in tabs Control beautification and perfection ” Reprinted by other websites , This may be something to be happy about , But some websites don't indicate the source and author . And go to Baidu to search this article , The number one ones are actually those who turn ...

  5. Sort-- Quick sort

    Quick sort 1 public class QuickSort{ 2 3 public static int Partition(int[] a,int low,int high){ 4 int pivo ...

  6. adt-bundle to update eclipse, And build android Environmental Science

    Once developed all the time android Download from the official website adt-bundle Of . It already includes eclipse and android SDK, build android The environment is very convenient , Just need to 3 Step :1. Download and install jdk( That is to say jar se ...

  7. WebService(2)-XML Series of Java and Xml Switch between

    Source code download : link :http://pan.baidu.com/s/1ntL1a7R password: rwp1 This paper mainly describes : Use jaxb Finish the object and xml Conversion between TestJava2xml.java ...

  8. EasyUI Combobox default setting

    /** * Binding operators , default setting , show CMCC, Traditional values 1 */ $('#operatingId').combobox({ url:'data_url', valueField:'id', t ...

  9. MVC Publish to windows2003 encounter 'System.Web.WebPages.Razor Error message

    Excerpt from : http://blog.csdn.net/lanqiao825/article/details/7840606 http://bbs.maticsoft.com/forum.php?mod=v ...

  10. Javascript Advanced programming learning notes (66)—— event (10) Change event

    Change event DOM2 Level change event , Can be in DOM Prompt when part of Change event is for XML or HTML DOM The design of the , Not specific to a language DOM2 Level defines the following change events : DOMSubtreeModif ...