lecture 9.18

1. a && b: a and b;  a || b: a or b

2. printf format

% D Decimal

% F a fixed number of decimal point position (% m.nf, field length of m bits, space fill bits, n bits after the decimal point)

%c  character

%s  string

\n  new line

\"  quotation mark

3. The difference is that while the latter do while at least once

Action 4. putchar (c) is a character to the output terminal, the output of the character (as can be the escape character \ n) when the character c is drawn single quotes, if c is a decimal between 0-127 when integer, the number corresponding to the output character code in ASCII

5. functions form

return-type function-name(parameters) {

  declarations

  statements

  return ...;

}

if return-type is void then the function does not return a value

if parameters is void then the function has no arguments

The assignment parameter will be calculated as f = 3 * 3, f = 9 is passed

6. the return statement can also be used to terminate a function of return-type void

return;

7. double like the float, but a higher precision after the decimal point is allowed more bits

8. array is similar with list in python, which is a collection of same-type variables, for an array of size N, valid subscripts are 0...N-1

9. #define placed at the beginning, and easy to modify the ease of understanding, the assignment can not be used directly in the absence of a definition number

10. C code format reference https://wiki.cse.unsw.edu.au/info/CoreCourses/StyleGuide

11. strings (functions do not know the size of the array, so the end of the array is labeled)

 

12. string is a special form of Array, below both can, but the second higher readability

char s[6] ={ 'h', 'e', 'l', 'l', 'o', '\0' };

char t[6] = "hello";

13. input with scanf (format-string, expr1 ...), when not want to input string, using atoi (string), which convert string into integer

Need to #include <stdlib.h>

14. typedef role is to type a new name

15. structures may be the result of a combination of different types, Data useful when complex, such as:

typedef struct {

  int day;

  int month;

  int year;

} Dated;

Small structure can be included in a larger structure inside

Declare variables to allocate memory as DateT christmas;

christmas.day = 25;

christmas.month = 12;

christmas.year = 2019;

16. stack is first in last out, you can not be different from the array based on its order to extract the elements inside out only in accordance with the principle of last-out to take in the recursion to use the stack

And queue different

17. herder file their use #include "Stack.h" format

 

Guess you like

Origin www.cnblogs.com/eleni/p/11559500.html