A slight problem with pointers in C

Updated on technology 2024-03-03
6 answers
  1. Anonymous users2024-02-06

    The p of both is a pointer.

    p=&t, change the content that p points to to the address of t, and p=&t is the address that changes the pointer to t.

    p=&t is equivalent to *p=t

    And, like:

    int t;

    int *p=&t;

    This is valid.

    Sentence 2 means:

    Define a variable p

    Indicates that the type of p is the pointer type.

    int indicates that the data pointed to by the pointer p is an integer.

    t is assigned a value to p, which is the address where the initial value of p is t.

    The whole sentence is equivalent to the following two sentences:

    int *p=&t;

    p=&t;

  2. Anonymous users2024-02-05

    p=t, which assigns the value of the variable t to the address pointed to by the pointer variable p.

    p=&t, which puts the address of t into the pointer variable p.

    where *p is the operation to take the value, and p itself is an address variable used to put the address.

    Added: At the time of definition:

    int *p=&t;

    This is the writing that assigns an initial value to this pointer variable.

    It is equivalent to: int *p;

    p=&t;It's important to note that once a pointer is defined, it should be assigned a value, and if it is not assigned, the next time you quote or move the pointer can have disastrous consequences.

    ps: If defined and after the initial value is assigned:

    p is an indirect reference, and * is an indirect operator, not the meaning of the * when the pointer is defined.

  3. Anonymous users2024-02-04

    First of all, if t is not a pointer variable, then this assignment is wrong.

    If t is a pointer variable, then p=t means that the address of t is assigned to p;

    If t is a variable of integer or real number, p=&t means that the address of t is assigned to p so that p points to the number.

  4. Anonymous users2024-02-03

    When declaring a variable.

    int *p ,t;

    p is the address used to store int type variables, and p=&t; is used when neededThe address where the t is stored.

    The application can directly represent the address of t by using *p.

    As for *p=t; Syntactically, it means that the value of a t is stored in the address to which p is pointed.

  5. Anonymous users2024-02-02

    The first one is to assign t to the pointer variable to point to.

    The second: define p pointing to t

    Because p is a variable that stores an address, and the address of another variable is stored in p, so that a point-to-point relationship is established, and if it is replaced with *p, it is t=&t pull, is that right?

    p denotes the space to which p points to.

  6. Anonymous users2024-02-01

    To take the address p=&t is to take the address of the variable t to p

    is pointing to the data, p is the pointer, and *p is the value of the data that p is referring to.

Related questions
9 answers2024-03-03

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

8 answers2024-03-03

The semicolon is the sign of the end of the statement, but the semicolon is not used after the loop, if, and subfunctions such as long long a (int b), and everything else is used, but two semicolons cannot be added, although it will not cause an error, but it may affect the result.

8 answers2024-03-03

It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More

6 answers2024-03-03

Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More

9 answers2024-03-03

Total Video Converter Final Chinese version。

It's not easy to use.,You tried it and said it.,I think it's very professional.,Conversion formats can be converted basically what I know.,Convert to VCD mobile phone format.,How many virginity numbers to convert,Screen size,Such as 176*220 can be modified。 >>>More