#include<stdio.h>
int sum(int,int);
int main()
{
int a=5;
int b=6;
int res;
res=sum(a,b);
printf("\n%d\n%d\n",a,b);
printf("%d",res);
}
int sum(int x,int y)
{
x=x+1;
y=y+3;
return y;
}
This is a sample program where my a and b values didint change and the result of modified y (ie)9 is returned back to main program...but my doubt is if iam doing the same program using pointers i am getting "CONVERITNG INT** INT* is NOT POSSIBLE???CAN U explain ....thank you..........
#include<stdio.h>
int* sum(int,int*);
int main()
{
int a=5;
int *b;
*b=6;
int *res;
res=sum(a,&b);
printf("\n%d\n%d\n",a,*b);
printf("%d",*res);
}
int* sum(int x,int *y)
{
x=x+1;
*y=*y+3;
return (&y);
}
iam very weak in pointers can you suggest me how to improve my skills in pointers........thanks in advance :)