001-ios Development Prelude-C language Notes

Source: Internet
Author: User
Tags macbook

Learning Goals

1. "Understanding" operating system

2. "Understanding" Application software

3. "Understanding" the classification of operating systems and market share

4. "Understanding" iOS operating system

5. "Understanding" the classification of application software development

6. "Understanding" Unix common commands

7. "Mastering" How to develop the first C language program

First, the operating system

Our computer is composed of many kinds of hardware devices, such as CPU, memory, hard disk, network card, motherboard, sound card .... If the computer only has these hardware devices, can it be used normally?

CPU: Responsible for calculating and processing data

Memory: Storing data (temporary)

Hard disk: Storing data (permanent)

Network card: Receive, send data

Sound card: Output sound signal

..........

But who gets the CPU to process the data? Who let the memory go to store the data? So the computer must have a "Boss" ( operating system ) to manage and coordinate the work of the computer between the various hardware harmony.

the role of computers : To help people do all kinds of things . How to get the computer to help us do things? We have to use the language and the way the computer can understand to communicate with it, and when it understands, it will do things according to our requirements. Computer equipment Since its inception, can only understand the binary language like 010101110010101, also known as machine language.

Operating System function : a software that runs directly on top of a computer device and is used to manage and coordinate the work of each computer's hardware. And the underlying complex operations are encapsulated for 1 relatively simple operations ( interfaces ).

Second, application software

software is the root of the interface provided by the operating system, these interfaces in a certain sequence to complete 1 specific functions, this is the application software . Operating system He is also a software, but an underlying software, because it deals directly with hardware.

The relationship between computer hardware devices, operating systems, and application software

The bottom is the hardware device , the operating system is allowed to run on the hardware device, the application software is allowed to run on the operating system.

Note :

1. Different operating systems encapsulate the interface is not the same.

2. With 1 application software, it is not possible to allow running on more than one operating system.

General steps to develop the application software :

1. Understand which interfaces the operating system provides.

2. Combine these functions in an orderly manner to complete our specific functions.

III. Classification of operating systems and market share

Operating system running on a PC ( personal computer )

windows:90%

Apple:os X 7%

linux:3%

......

Operating system running on the server

Windows server:20%

linux:80%

......

Operating system running on a mobile device

Google's android:70%

Apple's ios:25%

windows:5%

......

Iv. iOS operating system

iOS is an operating system that only runs on devices made by Apple, such as the iphone and ipad. OS (Operatingsystem) is the meaning of the operating system, the I Letter of iOS is the customary prefix for Apple named Products, and is lowercase . The iOS system was first called the iphone OS, but later, the operating system could run on top of other devices, so it was called iOS.

iOS development is the development of software that runs on iOS systems, so iOS development belongs to mobile development. And because iOS is a dedicated operating system for Apple mobile devices, iOS developers like to call the iOS siege Lion, and everyone thinks the programmer sounds more cock-silk.

V. Classification of application software development

Desktop Software Development : It is 1 separate window programs.

Web Development : The operation of the program depends on the browser, Web application development, that is, to do the site.

Mobile Development : Developing mobile device-based software.

Language of the development program

Machine Language : is 01010100101010 such a binary, can be directly recognized by the computer.

assembly Language : The use of words and mnemonic programming program, learning difficulty, portability is poor.

high-level language : The use of human English words to write programs, such as if (XXXX) conditional judgment statements, learning is relatively easy. However, the direct interaction between the high-level language and the hardware is not obvious.

General writing steps for high-level languages

1. Use words to write source code.

2. Use the compiler to translate the source code into machine language.

3. Then give the machine language to the computer to run.

the role of the terminal : You can set the system, you can set the mouse does not do things. And the execution of some programs must depend on the terminal to be able.

Vi. Common UNIX Commands

1 Macbook : ~ Itcast $ pwd

You can display the working path of the current terminal program. ~ Represents the home directory of the current user. Enter PWD directly to see the current directory

1 Macbook : ~ Itcast $ ls

Lists all the files and folders under the current working path. Direct input LS displays directories and files in the current directory

1 Macbook : ~ Itcast $ ls - L

Lists all files and files under the current working path in detail. Direct input ls-l is the list of directories and file details in the current directory.

1 Macbook : ~ Itcast $ CD

Change the work path, by default the working path of the terminal is the home directory of the current user. For example, a CD/switch to the root directory

1 Macbook : ~ Itcast $ Touch

Create a file in the terminal, such as Touch test.c, to create a test.c file in the current directory

Vii. How to develop a C-language program

It is necessary to familiarize yourself with the syntax of the C language and then compile the C code into an executable program by combining some words and symbols according to the syntax specification of the C language. Compile the time need to use the compiler, the compiler is actually a software, download and install can be used.

Write the first C program

Writing C program source files

To create 1 files, the suffix name of this file must be. C, then open the file and write our C code in this file.

Note: The C language is strictly case-sensitive. In addition to the contents of the double quotes, the code in other places must be entered using an English input method (because the symbol must be a half-width symbol, otherwise an error!). )

For example, we create a test.c file at the terminal

1 Macbook : ~ Itcast $ Touch Test . C

Write in File

<textarea class="crayon-plain print-no" style="-moz-tab-size: 4; font-size: 12px ! important; line-height: 16px ! important; z-index: 0; opacity: 0;" readonly="" data-settings="dblclick">#include <stdio.h>int main (int argc,const char * argv[]) {printf ("Hello world!\n"); return 0;}</textarea>
123456 #include <stdio.h>  int main ( int Span class= "crayon-v" >ARGC const char * argv [ ] ) {< /span>&NBSP;&NBSP;&NBSP;&NBSP; printf ( "Hello world!\n" Span class= "Crayon-sy"; &NBSP;&NBSP;&NBSP;&NBSP; return 0

Compiling C program source files

Compile the C source code into binary code using the compiler.

Command: The full name of the cc-c C source file, i.e.

1 Macbook : ~ Itcast $ cc - C Test . C

If normal, 1. o files are generated. This file we call the target file, in the target file, is the binary of the C file.

Note: When compiling, the code in the C source file will be checked to see if it conforms to the C syntax specification and will be generated if it conforms to the specification. O target file. Otherwise, the destination file will not be generated and will prompt for errors.

Link-generated target file

The generated target file. O can not be directly to the CPU to execute, a program that can be recognized and executed by the CPU must also have some additional code, that is, the boot code.

Link: Add the startup code for the target file, so that the program can be recognized and executed by the CPU.

Name: CC target file name

1 Macbook : ~ Itcast $ cc Test . O

All normal will generate 1 a.out program, this program can be recognized and executed by the CPU.

Execute C Program

Enter the following command in the terminal to execute the C program we wrote.

1 Macbook : ~ Itcast $ . / a . out

001-ios Development Prelude-C language Notes

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.