Day02 inspirational journey of learning IT Daniel

day02

Who Hengdao immediately, only my Flying Cow Great General!

Here is the day02've learned:

. 1 .
(. 1) is a process-oriented language C computer programming language.
(2) has a good cross-platform. (Not referring to cross-platform compiler)
(3) widely used in the computer-level development. OS -linux
(4) C is very close to computer architecture, hardware and software features to make us feel more computers.

2 .
(1) header - .h (2) the source file - .c

3 .
Beginners first C language code:

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

Note: I use VS2013 compiler is
explained: (1) First, be sure to include the basic input output header <1>
(2) int representation type defined variable is an integer, main entrance function <2>
(3) statement <5> The default function returns a value of 0.

4 . Data type
char // character data type
short // short integer
int // shaping
long // Long
long long // longer plastic
float // single precision float
double // double precision floating point

// C language there is no string type? Answer: No, you can use a pointer or a character to represent a character array. That char *, or char []

5 .
How do you know the size of the data type?
Here Insert Picture Description
// there is so much data type, in order to meet numerous application scenarios. //

Use types:
int = 200 is weight;
char CH = 'W';

6. variables and constants

(1) a method defined variables:
int = 150 Age;
a float weight = 45.5f;
char CH = 'W';
classification (2) variable:
<1> global variables
<2> local variable Here Insert Picture Description
used variables:
Here Insert Picture Description
7. Variable scope and effect period
(1) variable scope
<1> is a partial scope of local variables where the range variable.
<2> The scope of global variables is the entire project.

(2) effect of the variable cycle
<1> is a local variable life cycle: the life cycle begins entering the scope, the scope of the end of the life cycle.
<2> The life cycle of global variables are: the entire life cycle of the program.

8. Constant
(1) literal
(2) enum constant
(3) const modified constant variable
(4) #define identifier defined constants

#include<stdio.h>
enum sex{
male,
female,
secret
};
//male female secret 均为枚举常量
int main(){
3.14;//字面常量
1000;//字面常量
const int a = 1;//const修饰的常变量
#define MAX 100;//#define定义的标识符常量
return 0;
}

9.
String
example: "! Hello world \ n"

Marks the end of a string is the escape character \ 0. When calculating the string length \ end flag is 0, the string is not as
content
Here Insert Picture Description
common escape character
\ a warning characters, beep
\ b backspace
\ f feed character
\ n newline
\ r carriage return
\ t horizontal tab
\ v vertical tab
10. The
#define constants, and macros defined

#include<stdio.h>
#define MAX 100//见名知意,提升代码的可维护性
int main(){
int x1 = MAX;
int x2 = MAX;
int x3 = MAX;
return 0;
}
Released two original articles · won praise 4 · Views 322

Guess you like

Origin blog.csdn.net/Flying_Cow_Z/article/details/105138791