C language pointer program runs, how to do this C language pointer programming?

Updated on technology 2024-04-07
9 answers
  1. Anonymous users2024-02-07

    After testing, ** runs OK, and only 1 place is modified.

    #include

    int a[10]=;Global array.

    rev (int *m, int n) is a recursive function that reverses an integer array.

    int t;

    if(n>1) is performed if n is greater than 1.

    t=*m;t is an intermediate variable.

    m=*(m+n-1);The value that the current pointer points to is equal to the last 1 value.

    m+n-1)=t;

    rev(m+1,n-2);

    If the call continues recursively, it should be swapped, then the pointer is moved back by one bit, and the length is minus 2main().

    int i;

    rev(a,7);

    for(i=0;i<7;i++) According to the title, it should be 7, and if it is 10, there will be 3 zeros

    printf("%d",a[i]);

    printf("");

  2. Anonymous users2024-02-06

    The rev (int *m, int n) function swaps the array element pointed to by the pointer m with the n-1st element that follows it.

    int t;t is the temporary variable if(n>1) executed if n is greater than 1, recursively controlling the condition. }main()

  3. Anonymous users2024-02-05

    rev (int *m, int n) This function is a recursive function, it should be in reverse order.

  4. Anonymous users2024-02-04

    The pointer is not allocated memory, and the segfault is made.

  5. Anonymous users2024-02-03

    The program written according to the requirements of the question is as follows (see figure).

  6. Anonymous users2024-02-02

    Here's how I understand it:

    In C, you need to define a variable, and you need to understand two meanings of the variable itself

    1) What is the value in the variable? With the value, we can directly take the variable and participate in the operation, eg int a=5;A means 5 when calculating;

    2) Where are variables stored in memory? The storage location of the variable is the address of the variable, so this address can be stored with a pointer, eg int a=5, *p=&a;Here p is the pointer variable, which stores the address of variable a, at this time, if you use the value of the a variable, you can directly use a, or you can use *p, *p is through the pointer of p (that is, the address of a), indirectly find a, in the program *p and a are equivalent.

  7. Anonymous users2024-02-01

    The pointer points to the address, so your modification of the pointer will also affect the value of the original address, so when you need to modify the variable outside the function in the function, you can consider the pointer, of course, the pointer can also connect the nodes in the structure and the like, and there are functions related to the follow-up, as long as you figure it out, you will understand.

  8. Anonymous users2024-01-31

    A pointer can be understood as an address, that is, a pointer to an address, and there are three questions to be clarified before using it, the type of pointer, the type of pointer pointing, and the memory area of the pointer pointing to the value. The value is passed by passing the address of the value.

  9. Anonymous users2024-01-30

    It is the address of the address, and then we will learn that the pointer function is the function parameter is the pointer type, we usually learn int, float, etc., and we will also learn that the function pointer is the address of the call function.

Related questions
9 answers2024-04-07

Scope. You static char *chh;

static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More

5 answers2024-04-07

Question 1: pt1=&a;pt2=&b;pt1 and pt2 are not defined, years are defined as. >>>More

4 answers2024-04-07

2. 1, True 2, False (there is only one program) 3, False (not necessarily) 4, True. >>>More

19 answers2024-04-07

C language in computer software (Windows platform) programming.

7 answers2024-04-07

char *p;

uchar log_type; >>>More