From Huawei's interview reflects its own basic knowledge.

xiaoxiao2021-03-06  19

Char ** P, A [16] [8]; Q: Is P = A cause the program to have problems in the future? why?

When I started looking at this question, I thought it was as thinking: A [16] [8] is a two-dimensional array, then A [16] is not an array of first-level pointers, then A is an array Secondary pointer. This p = a is a matter of course. But I am wrong, because the foundation is not solid, I ignore the storage mode of the two-dimensional array, in fact, the two-dimensional array is stored in the form of one-dimensional array .a. In fact, it is a simple primary pointer.

In order to confirm that I wrote the following simple programs tested

Void test (char ** p);

Int main (void) {char A [10] [8];

Void Test (a); return 0;}

Void test (char ** p) {

} The result is 'test': Illegal use of type 'void'c: / documents and settings / libing / desktop /sasa/sa.cpp (8): Error C2440:' Initializing ': Cannot Convert from' Char [10] [8] 'TO' Int 'This Conversion Requires A Reinterpret_cast, a c-style cast or function-style casters Executing Cl.exe.

It seems that before learning, the basic learning is still unable to relax.

转载请注明原文地址:https://www.9cbs.com/read-48836.html

New Post(0)