Rookie said C (a)--know what is C language? Haha, I know you don't know!

Source: Internet
Author: User
Tags sin

Objective

You know what C language is? Haha, I know you do not know, or how to come here, then?

C language is the only way to learn programming new children's shoes, think of that year in order to accepted the morning still sitting in front of the computer a problem of the pain experience, the heart of the panic, how I hope to have a senior sister can help me, help......!!! Helpless, no one bird me!

See September is coming, in order to alleviate the bitterness of a problem, let new children's shoes in the hard code on the road has a trace of happiness, plus weekend and idle panic , to write ...

noun explanation

Since it is a new knowledge, there must be a variety of non-mainstream terminology, if you do not know as a small meat, not only out, no time outing is the most painful ...

In short, the original C language learning is to do the problem, like doing math problems, just will be part of the mathematical symbols in the C language instead, and then run out on the computer.

rookie : Very simple, that is, you "weak explosion"! Think of these 2 words are bitter, our group name is called "Rookie Team"! When can I upgrade?! At the beginning did not know what the wind, such as no ambition of the name of the son!

Great God : very simple, let the people worship the good character! Great God in the Blog Park ... Please come and visit me often! Will learn a lot of things ^_^

code : Also called Code, program. Is the result of programming, the product of the program Ape ~ ~

variables : For a simple example, the math is common: if, a = 1, b = 2,c = a + B, what is the value of C? The A, B, c are all variables, can be changed, a can also be a = 1.

Constants : 1 in the above, 2 is constant, unchanged. 1 is 1 and cannot be written as 1 = 2.

Variable type : Also called data type. As people divide adults and children, variables are categorized as well. In mathematics, there are decimals and integers. Both A and B in the above formula are integers. In c language, variable basic types can be classified as Integer (integer), floating point (decimal), integer type (short), Integer (int), and long shape. Floating-point type is also divided into single-precision (float), double-precision (double). There are 2 commonly used in early learning: int and float.

Defining variables : Defining variables like your father gave you a name. You are a person (corresponding to a variable), your name is silly (corresponding variable name, such as the previous said, A, b).

function : This is very difficult to explain, let my daughter think for a moment ... What is also supposed to be in high school, trigonometric functions know?! The function is similar to that of trigonometric functions. When we use trigonometric functions like this: sin (pi), cos (PI), this in the C language, also known as "with", a professional is called "call" function, also called run function. But we don't know how sin is achieved in mathematics. In C, it is also necessary to implement some simple functions to be called when needed.

At the beginning of the study, you know that the main () function can write a lot of code. The main () function is the system autorun (call) function, which is also the entry point for the entire code to run.

compile : In the development software, choose Build, the software will start to check whether you write code syntax errors, there is no mistake (that is, compile) to run the code.

console : Popular Point, is the black box. It shows the results of the printf () output function execution.

input : input function: scanf (); After the program runs, enter the value of the corresponding variable in the console.

code example: Enter the value of integer A, scanf ("%d", &a); PS:%d indicates that the input type is an integer. & Call address symbol, remember to add.

output : output function: printf (); After the program runs, the output is displayed in the console.

code example: Outputs the value of integer A, printf ("%d", a);

Run : Click the "Run" button in the development software and the software will start executing the code you wrote and then pop up the console.

BUG: Hey, this is the most to let the program ape headache. is the error in the code, which results in abnormal operation. Sometimes the code is more, not working properly, how can not find the wrong place.

Whining...... Do not know the above explanation can let the zero basis of you understand the slightest silk ... Don't worry, let's go over it together.

First Program (Hello World)

STEP1: Write good code in development software

1 #include <stdio.h>2int  main ()3{4     printf ("Hello world! " ); 6     return 0 ; 7 }

STEP2: Compile + Run

STEP3: Code Description

// The comment is here, and the code runs without execution.  ///#include <stdio.h> means the introduction of library files, there are common functions in the implementation of the file, we only need to invoke, such as: printf ()#include <stdio.h >//mian () main function, program entry int  main () {    printf ("Hello world! "); // output Hello world! in the console (black box)    return 0; // function End, return 0}

Second program (A+B)

STEP1: Code

#include <stdio.h>int  main () {    int A a , B;     int C;     1 ;     2 ;     = a + b;    printf ("C has a value of:    %d", c)    ; return 0 ;}

STEP2: Compile + Run

STEP3: Code Description

#include <stdio.h>intMain () {intb;//defining variables A and b    intC//define variable CA =1;//assign a value of 1 to ab =2;//assign a value of 2 to Bc = A +b; printf ("the value of C is:%d", c);//in the console output C, double quotation marks inside%d, corresponding to the following C    return 0;}

Rookie said C (a)--know what is C language? Haha, I know you don't know!

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.