Skip to content

Commit

Permalink
retrun poniter
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaanilkumar committed Jun 29, 2020
1 parent 8e284b3 commit 7d38cc5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions C/return_pointer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// functin returning pointer

#include<stdio.h>
int *larger(int *, int *); /* prototype */
void main ( )
{
int a = 10;
int b = 20;
int *p;
p = larger(&a,&b); //Function call
printf ("larger is %d", *p);
}
int *larger (int *x, int *y)
{
if (*x>*y)
return (x); /*address of a */
else
return (y); /* address of b */
}

0 comments on commit 7d38cc5

Please sign in to comment.