Chapter One: Overview of C language and how to run C program on machine

Source: Internet
Author: User

Chapter One: Overview of C language and how to run C program on machine

Let programming change the world

The

C Language Overview

The development process of C language

The C language was invented in the early 70. In 1978, the C language was formally published by the American Telephone and Telegraph Company (T) Bell Laboratory. At the same time by B.w.kernighan and D.m.ritchit co-authored the famous "The C programming LANGUAGE" a book. Usually referred to as "K&r", some people call it "K&r" standard. However, a complete standard C language was not defined in the K&r, which was later developed by the National Standards Institute (AMERICAN) (standards Institute) on the basis of a C language standard published in 1983. Usually called ANSI C.

The Most outstanding programming language in the modern age

1. The early C language was primarily used for UNIX systems. Because of the strong function of C language and the advantages of various aspects gradually for people to understand, in the 80 's, C began to enter other operating systems, and soon in all kinds of large, medium, small and microcomputer has been widely used, become one of the most outstanding programming language.

C language Features: Concise, compact, easy to use, flexible.

ANSI C altogether has only 32 keywords:

Auto Break  Case Char Const Continue default Do Double Else enum extern float  forGoto if int LongRegisterreturn  ShortsignedStaticSizof
struct Switchtypedef Union UNSIGNEDvoid volatile while

9 Kinds of Control statements, program writing freedom, mainly in lowercase letters, compression of all unnecessary ingredients.

2 • Rich operator. There are 34 kinds. C handles parentheses, assignments, commas, and so on as operators. Thus, the operation type of C is very rich, it can realize the arithmetic that other high-level language is difficult to implement.

3 · Rich data structure type.

4 · have structured control statements.

5 · The grammar limit is not very strict, the program design Freedom is big.

6 · C language allows direct access to physical address, can do bit (bits) operation, can achieve most of the functions of assembly language, can directly operate the hardware. So some people call it intermediate language.

7 · Generate high-quality code, high program execution efficiency.

8 · In contrast to assembly language, the program written in C is good portability.

However, C language requirements for programmers are also high, programmers with C writing programs will feel less restrictive, flexible and powerful, but more than other high-level language in learning more difficult.

Process and object-oriented program design ideas

Process oriented: "Process oriented" is an event-centric programming idea. is to analyze the steps required to solve the problem, and then use the function to implement the step by step, the use of a one-time call in turn. Object-oriented: Object Oriented (OO) is a thing-centric programming idea.

void Main () {    printf (" Hello, world! n");}

Main is the function name of the main function, which means that this is a main function. each C source program must have, and only have one main function (main function). function Call statement, the function of the printf function is to send the contents of the output to the display to display. the printf function is a system-defined standard function that can be called directly in a program.

include<math.h>#include<stdio.h> main () {    double  x,s;    printf ("input number:n");    scanf ("%lf",&x);    s=sin (x);    printf ("sine of%LF is%LFN", X,s);}

include is called a file containing command a file with an. h extension is called a header file that defines two real variables to be used by the following program to display prompt information from the keyboard to obtain a real number x to find the sine of x and assign it to the variable s Show program operation result main function End

#include <math.h>#include<stdio.h>intMaxintAintb);/*function Description*/Main ()/*Main function*/{    intX, Y, Z/*Variable Description*/    intMaxintAintb);/*function Description*/printf ("input Numbers:n"); scanf ("%d%d", &x,&y);/*enter x, y values*/Z=max (x, y);/*Call the Max function*/printf ("maxmum=%d", z);/*Output*/} intMaxintAintb/*defining the Max function*/{    if(A&GT;B)returnAElse returnb/*return the result to the keynote function*/}

Chapter One: Overview of C language and how to run C program on machine

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.