Difference between char [] and & char []?

I am trying to better understand the operator (address) for use in the API.

Here is my sample API function signature:

apiFunction(const int*)

I am working on another code and they use the API as follows:

int inputs[1] = {1};
apiFunction((const int*)&inputs);

I think the correct use should be:

int inputs[1] = {1};
apiFunction(inputs);

Is there a difference between “inputs” and “inputs” when the “inputs” are a char array with a length of 1?

They look the same when I do printf, but I'm afraid that I might format it incorrectly:

printf("%p, %p", inputs, (const int*)&inputs);

Output (for example):

0204DE94 0204DE94
+4
source share
1 answer

&input int (*)[1], 1. input, ( ) int *.

, .

apiFunction, const int *, &input ( ), input, . , :

apiFunction(inputs);

, , .

+3

Source: https://habr.com/ru/post/1683460/


All Articles