Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Passing pointer to function

#include <stdio.h>
   
void getDoubleValue(int *F){
   *F = *F + 2;
   printf("F(Formal Parameter) = %d
", *F);
}
  
int main(){
   int A;
   printf("Enter a numbers
");
   scanf("%d", &A);
   /* Calling function using call by reference */
   getDoubleValue(&A);
   /* Any change in the value of formal parameter(F)
   will effect the value of actual parameter(A) */
   printf("A(Actual Parameter) = %d
", A);
     
   return 0;
}
Source by www.techcrashcourse.com #
 
PREVIOUS NEXT
Tagged: #Passing #pointer #function
ADD COMMENT
Topic
Name
3+9 =