1. Integer: ... int, .toi, srand (), rand (), POW ()
The following is an integer in the range of
integer output
binary, octal, hexadecimal writing
usually write decimal, in order to align or other reasons, will add 0 before the number is irrelevant, but in the C language, do not add 0 before the decimal number, the computer will be mistaken for an octal number. C provides several common language library functions, the following statement:
C typedef keyword language allows programmers to use an alias to a data type definition:
typedef unsigned Long ulong
a certain range of the random number (i.e., take the remainder modulo adder)
VI _Public. H
VI _public.c
VI book46.c
VI _public.h
VI _public.c
VI book46.c
generating 12 random numbers, stored in an array in the range of 1-52, should not be repeated and finally displayed on the screen
gcc - g -o book63 book63.c, gdb book63, q quit gdb
2. Character: ASCII code, escapes
The following character is an integer
int variable stored in memory is an integer of itself, if the output% c, will be converted into a corresponding character according to the ASCII code table
to find the corresponding ASCII code 44, is found, No. The following are commonly used character library functions
uppercase and lowercase letters ascii code difference 32
3. Float: double, Ke Ji, ceil, fabs, round, fmod, floor
Measured at float, double, and three kinds of long floating point number of bytes of data memory space of a double
on precision floating point: floating-point numbers in a computer storage IEEE standard, single precision float mantissa M range 23, 23 is approximately 2 ^ 7 bits, the quasi-5,6 bit precision is
seen from the above two characteristics of the program numbers float:
test double type
from the above two procedures may be seen that characteristic numbers double
int% D, Long% LD, Scanf ( " % lf "), float output using% f, double output using% lf, the test results show, double% f output may be employed, long double output using% Lf, note that a capital L
浮点数的输出:
% lf default six decimal display, with n digits after decimal point% .nlf
convert integer to floating-point
write sample program, test result exceeds the assigned floating-point range of
overwriting floating point functions library of common
double四舍五入
or
double向上取整数
double向下取整数
4.字符串:%s,strlen,STRCPY,DeleteLChar,GetXMLValue,return
% S string is output, can be added to control the format, commonly used as follows:
a string of characters is an array of strings is out of bounds array bounds.
Since consecutive memory strname [0] is strname [1] occupied, so strname [0] garbled. strname [1] is not connected to the back, so that normal display
1. Get the length of the string (strlen)
5. The string concatenation (strncat)
6. The string comparison (strcmp, a strncmp)
strcpy: Copy String, strcat: String CAT (splicing ), strcmp: string Compare
% for P value of the output pointer, output address character
8. the search string (Strstr)
if n is less than the length of the character string src, the copy after the string, after adding dest 0 until the n
If n is greater than the length of the string src, interception of the first n characters of src, dest not append 0 after
the memory worthless, stable above all, to initialize a variable
location (address) offset usage
1.STRLEN:
2.STRCPY/STRNCPY:
without strcpy library function:
using strcpy library function:
3.STRCAT/STRNCAT:
not strcat library function:
using library function strcat:
4.STRCHR:
5.STRRCHR:
= = World
1.DeleteLChar:
2.DeleteRChar:删除字符串右边指定的字符
3.DeleteLRChar:
4.DeleteMStr:
5.LPad:在字符串左边补字符到指定长度
following incoming pointers to structures:
0 false, return -1 out of general circulation failure or false