Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Call by reference to pass an array to the function in C-

#include <stdio.h>
void display( int *powers)
{
printf("%d ", *powers);
}
int main()
{
printf("Welcome to Dataflair tutorials!

");
int i;
int array[] = {1, 2, 4, 9, 25, 36, 49, 64, 81, 100};
for (i=0; i<10; i++)
{
display(&array[i]); // Passing the address of array to the function
}
return 0;
}
 
PREVIOUS NEXT
Tagged: #Call #reference #pass #array #function
ADD COMMENT
Topic
Name
9+4 =