Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Why is int a[]={ 1, 2,3,4,5} right and int*p={ 1, 2,3,4,5} wrong? Seek an explanation
Why is int a[]={ 1, 2,3,4,5} right and int*p={ 1, 2,3,4,5} wrong? Seek an explanation
Int a[]={ 1, 2,3,4,5} is actually allocated to A after initializing the space with {1, 2,3,4,5}; According to ANSI C++, the definition of int*p refers to P, and space must be explicitly allocated for it, otherwise the unknown point of P is uncertain.

The difference between them is determined by Ansi/ISO C++ specification.