C Language Blog Job--function nested call

Source: Internet
Author: User
Tags array definition function prototype

First, the Experiment Operation PTA Topic: 6-7 Recursive method for any 10 data in descending order design ideas
 定义整型变量 max=a[0],temp,循环变量i 如果 n==1  a[n-1]=a[0] 设置递归出口 否则 for i=0 to i=n-1; 如果 a[i]>a[n-1]      交换a[i]和a[n-1]; end for重复进行,每次n-1,直到递归出口      
Code

Debugging issues
    • 1, when the maximum value is found, the other values have changed--------If statement does not have curly braces

    • 2, start without setting the recursive exit causes the program to crash

Student performance management System (not yet completed) 1.2.1 Drawing function module diagram, briefly introduces function function. 1.2.2 Display your engineering documents, such as:

1.2.3 function Code section 1.2.4 Debug Results show 1.2.5 Debugging encountered problems and solutions. Second, this week's topic set PTA Final ranking.

Third, read the code four, this week to learn summary 10.3.2 macro basic definition (used to define some symbolic constants, in the program all occurrences of the macro name will be replaced with a macro definition string, so also known asmacro Substitution.。 A Macro-defined Format
#define 宏名  宏定义字符串//以#开始,表起编译预处理作用,而不是真正的C语句,行尾无需跟分号(分号会被当成宏替换内容)。#define  TRUE  1
Two. Use of macros
    • 1. Symbolic constants, such as Pi.

    • 2. Simple function implementation (to complete a line followed by "" means that the line is not finished, and the next line together to become a full line)

    • 3. Easy to write programs (when you use some of the same content multiple times in a program)

Three. Macro definition with parameters (simple function function of macro) the difference between a macro reference and a function call:
    • 1. Implementation process
      Macro references are completed when the program compiles preprocessing
      function calls are performed when the program executes

    • 2. Invocation Features
      Macro references do not calculate, directly replace
      Get in
      function call, if the argument is an expression, evaluates the expression first, and then passes the result, so the macro reference should pay attention to the use of parentheses.

10.3.4 file contains 1. format
#include<需包含的文件名>//C语言标准头文件或#include“需包含的文件名”//当前文件夹被包含的文件
2. Application of header files

I. Common functions of ctype.h
    • 1.isalnum
      Function: Tests whether the ASCII symbol of the incoming parameter is a number or an English letter, and when the incoming parameter is a~z, A~z, 0~9, the function returns a value other than 0, otherwise returns zero.
      Returns a condition with a value other than 0: incoming characters a~z, a~z, 0~9 or number 65~90, 97~122, 48~57.

    • 2.isalpha
      Function: Tests whether the ASCII symbol of the incoming parameter is an English letter, and when the incoming parameter is a~z, A~z, the function returns a value other than 0, otherwise returns zero.
      Returns a condition with a value other than 0: the passed-in character a~z, A~z, or 65~90, 97~122.

    • 3.isdigit
      Function: Tests whether an incoming parameter has an ASCII symbol that corresponds to an Arabic numeral, and when the incoming parameter is 0~9, the function returns a value other than 0, otherwise returns zero.
      Returns the condition of a value other than 0: the passed-in character 0~9, or the number 48~57.

    • 4.isupper
      Function: Test whether the incoming parameter is an uppercase English letter, when the incoming parameter is a~z, the function returns a value other than 0, otherwise returns zero.
      Returns the condition of a value other than 0: the passed-in character a~z or number 97~122.

    • 5.islower
      Function: Test whether the incoming parameter is a lowercase English letter, when the incoming parameter is a~z, the function returns a value other than 0, otherwise returns zero.
      Returns the condition of a value other than 0: the passed-in character a~z or number 97~122.

Ii. Common functions of Strins.h
    • 1. Function Name: strcpy
      Function: Copy one string to another
      Usage: char strcpy (char destin, Char *source);

    • 2. Function Name: strncpy
      Function: copies up to n characters in the string src to the character array dest (it does not stop copying like strcpy, but waits for n characters to start copying), and returns a pointer to Dest.

    • 3. Function Name: strcat
      Function: string concatenation function
      Usage: char strcat (char destin, Char *source);

    • 4. Function Name: strcmp
      Function: string comparison
      Usage: intstrcmp (char str1, char str2);
      See ASIC code, STR1>STR2, return value > 0, two strings equal, return 0. STR1<STR2, return value <0;

    • 5. Function Name: strlen
      Function: The strlen function is the length of the string, it is calculated from the beginning of the string to the first address to meet the stop count, if you only define the initial value is not assigned to it, the result is uncertain, it will be from the beginning of the string is written down, until the encounter ' \ ' will stop.

    • 6. Function Name: strstr
      Function: Finds the first occurrence of a specified string in a string
      Usage: char strstr (char str1, char *str2);

    • 7. Function Name: STRUPR
      Function: Converts lowercase letters in strings to uppercase
      Usage: char strupr (char str);

Three, Stdlib.h commonly used
    • 1. Function Name: malloc
      Function prototype: void * malloc (unsigned size);
      function function: Allocate a size byte storage area

    • 2. Function Name: Free
      function function: Release the memory area referred to by P

    • 3. Function Name: Rand
      Function prototype: int rand (void);
      function function: Generates random integers between 0 and 32767 (0 to 0X7FFF)

    • 4. Function Name: atof
      Function prototype: Double atof (char *str)
      function function: Converts a string into a double-precision value

    • 5. Function Name: atoi
      function prototypes: int atoi (char *str)
      function function: Converts a string into an integer value

1. Summarize what you learned this week. 12.26 Pointer Advanced

-1 concept of the pointer array: Each element of the array is a pointer type, with memory address, then this array is the pointer array
General form of a generic pointer array definition:

类型名 *数组名[数组长度]

Such as:

char *color[5];

An array that defines the type of the character pointer
Where Color[i] holds the first address of a string.

    • 2. Exchange of pointer arrays
      Such as:
char *temp;tamp=color[0];color[0]=color[4];color[4]=temp;

Textbook 266
For this operation, the color string itself does not change, except that color[0] and color[4] swap the cells pointed to.

3. Pointer to pointer (also known as Level two pointer)
    • (1) Definition

Pointers to pointers are generally defined as:

类型名**变量名;

Textbook 266

int a=10;int *p=&a;int **pp=&p;

A,*P,**PP represent the same unit, their values are the same

    • (2) Level two pointer operation

Reading textbook 266

2. List some of the wrong questions this week. 1. Class School
    • Interactive 12.25

      -Interactive 12.27 Pointer array
      1

      2

    • C Language Preview Job--function nested call

。。。。。 Not completed

C Language Blog Job--function nested call

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.