Home > Back-end >  Dear bosses, does anyone know the p1, p2 why don't point to the first structure variables, and
Dear bosses, does anyone know the p1, p2 why don't point to the first structure variables, and

Time:10-09

CodePudding user response:

Open space first

Otherwise after input where to put

CodePudding user response:

Do not understand the meaning of the original poster, or describe the building Lord has a problem, the original poster of the code is dynamic application space, because of p1, p2 are wild pointer, and did not let the location of the pointer to effective can read and write, because malloc applied for memory, let the pointer to can read and write memory, the back can use, otherwise, the wild pointer to directly use there will be a period of errors,

CodePudding user response:

P1, p2 is structure pointer to apply for a good memory, this is equivalent to point to structure variables, only the former is a dynamic application memory, which is to have stated the structure of the variable address

CodePudding user response:

reference 2 building self-confidence boy reply:
don't understand the meaning of the original poster, or describe the building Lord has a problem, the original poster of the code is dynamic application space, because the p1 and p2 are wild pointer, did not make the location of the pointer to effective can read and write, because malloc applied for memory, let the pointer to can read and write memory, you can use the back, otherwise, the wild pointer to directly use will appear error,

Know, understand, thank you very much (? 'omega `?) !
  • Related