Passing ~ pass array elements in function using call by reference method in c language.

passing elements of array in function               using call by reference method 

■》Input->

#include<stdio.h>

#include<conio.h>

void display(int*);

void main()

{

  int i;

  int arr[5]={1,2,3,4,5};

  for(int i=0; i<5; i++){

  display(&arr[i]);

  }

  getch();

 }

 void display(int *a)

 {

  printf("%d ",*a);

 }

■》 Output->

1 2 3 4 5

Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.