Is this possible in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is this possible in c?

int fun(int a[22]);

29th Jan 2019, 1:45 PM
Kiran Kumar.C
3 Answers
+ 1
yes it is. but you should know that an array type is passed into a function as a pointer to the first element of the array, you can use array notation (int[]) or pointer notation (int*) in the function declaration, the compiler always treats it as pointer (int*). for example, the following declarations are equivalent: int fun(int a[22]); int fun(int *a); int fun(int a[]); they will be treated as int* by the compiler, as follow. the size of the array given in [] is ignored.
29th Jan 2019, 11:16 PM
MO ELomari
+ 2
And what is it supposed to do?
29th Jan 2019, 1:57 PM
Maneren
Maneren - avatar
0
It is a prototype
29th Jan 2019, 2:46 PM
Kiran Kumar.C