?
As I said A means &A[0] so by passing A you passed the address to the procedure you can de-reference it over there by doing A[index] (since box brackets and pointer arithmetics are interchangable)
Got a confusion in identifying what's scope of A is
A is in main But you passed its address to Sum...
So it means A is kinda like global for function Sumofelement
void f1(int* a, char* b) { printf("%d%c", *a, *b); //Will print 5_ printf("%d%c", x, y); //Compiler error because x and y arent here } int main() { int x = 5; char y = 95; f1(&x, &y); }
Обсуждают сегодня