C Language Pointers

Source: Internet
Author: User

First, the PTA experimental work 1:6-2 to find the maximum number of groups and the second maximum number 1. PTA Submission List

2. Design Ideas
定义整形变量 i,max=a[0],temp,b,lmax=a[1];for i=0 to n-1;a[i]>max进行判断是否有更大的数max=a[i];b=i; a[0]=max将最大数放在数组的第0个for i=1 to n;lmax=a[i]进行判断是否有更大的数lmax=a[i];b=i;a[1]=lmax将次大值放在数组的第一个
3. Code

4. Problems encountered in debugging process and PTA Submission List situation description.
    • The relationship between pointers and arrays is not clarified, resulting in compilation errors.

      Topic 2:6-9 to find the last occurrence of the substring in the parent string address 1. PTA Submission List

2. Design Ideas

```
Define shaping variables i=0,count=0,bj,j,flag=0,k=0; array bg[100]
The number of i=0 to t[i]!= ' + ' with the count++ statistic array character
For i=0 to s[i]!= ' + '
S[I]==T[0] Proceed to the next decision
For J=0 to Count-1
J=count indicates that the same character exists, flag equals 1 for marking
For J=BJ to s[j]!= ' + '
Using the new array bg[k++]=s[j] to represent
For i=0 to bg[i]!= ' + '
Swap characters with array S[i]=bg[i], return s;
Flag!=0, returns null

3. Code

4. Problems encountered in debugging process and PTA Submission List situation description.
    • No array = ' n '; immediately below the newly obtained array, causing the compiler to fail to output.

      Topic 3:6-10 character string change 1. PTA Submission List

2. Design Ideas

3. Code

4. Problems encountered in debugging process and PTA Submission List situation description. Second, this week's topic set PTA Final ranking.

Third, read the code

    • The code of the class seems clear, simple and easy to understand.

    • Jia Liang This inscription character string change is used in the array to move the direct ordering, simple and clear.

Iv. Summary of this week's study

1. Summarize what you learned this week.
    • With # include
    • You can use pointers to represent arrays, in function definitions char *b, where the contents below the function can refer to p[i] to represent the values of the array in the main function;
    • The pointer p is an address that, when it represents an array, can represent the values of the represented array individually, p++.
    • The pointer is initialized when the pointer is applied.
    • Defines a pointer to another pointer, assigns a value to the pointer, and so on, as the address content changes
      As long as the pointer to that address will change
    • In the data structure should pay attention to add; Otherwise, it will cause a compilation error.

      2. List some of the wrong questions this week.

    • Reference answer
      int N
      A[i]==x
      j<
      n-1
      n=n-1
    • My answer.
      int m; not seen below i<N;
      A[i]==x
      j<N-2 did not consider the boundary problem
      N=*n-1

    • Reference answer
      Sum=fun (s)
      S
      sum=sum+
      s ' 0 '
    • My answer.
      Sum=fun (s)
      S!=0
      sum=sum+
      s does not convert it to a number

    • Reference answer
      Length (s)
      *q
      return n
    • My answer.
      Length (s)
      *q!=0
      return 0; Returns the quantity.

C Language Pointers

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.