Get a basic understanding of C language!

Source: Internet
Author: User

At the beginning of the study, the teacher did not go straight to the subject, but first take us to understand what is the program, what is the algorithm, flowchart, and C language history of some things, so as to assist us in our future study.

Let's start with a brief introduction to what you've learned:

Introduction to C language

The C language was designed by Bell Labs ' Dennis Ritchie in 1973. C was originally used to develop system-level programs.

On the microcomputer, there are many good-performing commodity C language systems available. Includes Turbo C, Borland

C language Features:

Structured programming Language: Clear hierarchy, easy to organize programs in a modular way, easy to debug and maintain

Simple statement: It is relatively easy to get started in learning, and C language summarizes the library concepts presented in other languages.

Powerful: It can be used for the development of system software, and also for the development of application software.

Good transplant: As long as the language slightly modified, you can adapt to different models of machines or various types of operating systems.

And then I learned, what is the program? What do you mean by algorithms?

A program is a collection of ordered instructions written to allow a computer to perform certain operations or solve a problem.

Algorithm: the specific methods and steps to solve the problem.

Flow chart is intuitive, clear, more conducive to people to design and understand the algorithm . ( It uses a predefined set of symbols to illustrate how to perform specific tasks )

The various components of the flowchart are as follows:

Simple drawing flowchart

The history of the computer is also mentioned.

It knows the pros and cons of each language are different:

1. Machine Language

1) Introduction: All code inside only 0 and 1, each instruction is called "Machine instruction"

2) Advantages

U code can be directly recognized by the computer , directly to the hardware , program execution efficiency is very high

You can directly access and control the computer's various hardware devices , such as disk , memory ,CPU, I/O ports , etc.

3) Disadvantages

The U program is full of 0 and 1 instruction codes with poor readability and error-prone

U is very dependent on hardware , so the machine language of different models of computer is not the same . that is to say, if 2 different models of machines want to achieve the same function , you need to write 2 sets of completely different code

You have to memorize all the instructions and instructions of the computer you are using , and the instructions are more difficult to remember.

1) Use the occasion

In summary, machine language is difficult to master and promote , now in addition to computer manufacturers of professionals , the vast majority of programmers have no longer to learn machine language

1. Assembly Language

1) Introduction: Replace machine instructions with English words and other symbols

2) Advantages

U like machine language, you can directly access , control the computer's various hardware devices

You use less memory and perform faster

3) Disadvantages

U different machines have different assembly language syntax and compilers , code lacks portability , that is, a program can only run on one machine , you can't run it on another machine.

The U symbol is very many , difficult to remember , even if the completion of simple functions also requires a lot of assembly language code , It is easy to produce a BUG, difficult to debug

U must know the hardware very well , the development efficiency is very low , the cycle is long and monotonous

4) Use the occasion

U operating system kernel, driver, microcontroller program

Encryption, decryption and decoding of U software

Manufacture and prevention of U virus

debugging and Analysis of U program

2. Advanced Language

1) Introduction: Close to natural language

2) Advantages

U simple, easy to use, easy to understand, syntax and structure similar to general English

U away from the direct operation of the hardware, so that the average person after learning can be programmed, without being too familiar with the hardware knowledge

U a program can also be run on different machines, with portability

3) Disadvantages

U program can not be directly recognized by the computer, it needs to be translated into binary instructions by the compiler to run to the computer

4) types:c ,C+ +,C #,Java,objective-c Wait

comparison of three different languages

respectively, using machine language, assembly language, C Language (high-level language) to write a program to calculate the

1) Machine language: It is a heavenly book!!!

10111000 00000001

00000000 00000101

00000001 00000000

2) Assembly language: Readability a little better, but trouble

MOV ax,1

ADD ax,1

3) C language: Streamlined, easy to understand

;

Split **************************************

Then learn the first program Helloword, understand the basic structure of C language

basic structure of C program

#include <stdio.h> =================>>> files with an. h suffix are called header files,

can be A standard library file that is readily available in a C program, or a custom library file.

void main () ===================>> function library was introduced.

{

printf ("Hello world\n") prints the characters written;=================>> printf (output).

} 

comments in the C language : Used to interpret the code primarily for programmers to see

single-line comment

/*

Multi-line comments

*/

C language Execution Process

The NewLine and tab characters in the C language are: \ n \ t

for example;

#include <stdio.h>

int main ()

{

\ n: line break \ t: tab Stop

/*

printf ("************\n");

printf ("*\n");

printf ("*\n");

printf ("*\n");

printf ("*\n");

printf ("************\n");

*/

printf (" name \ t language \ t math \ T English \ n");

printf (" Zhang San \t80\t90\t70\n");

return 0;

}

To this end. Through the study of C language has a preliminary understanding and understanding.

Get a basic understanding of C language!

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.