Hi all,
I was wondering whether the following code is proper i want to modify the values of a and b
#include <stdio.h>
void modify(int &, int &);
int main(int argc, char *argv[])
{
int a=12;
int b=13;
modify(&a, &b);
}
void modify(int &p, int &q)
{
int *f1, *f2;
f1=p;
f2=q;
*f1 = 21;
*f2 = 31;
printf("%d%d",*f1,*f2);
}
Is it possible to pass the address parameters like the one i have shown? i know it is mistake and we need to give pointers to actually make it work? but why the above code does not work?
thanks in advance,
regards,
satya
I was wondering whether the following code is proper i want to modify the values of a and b
#include <stdio.h>
void modify(int &, int &);
int main(int argc, char *argv[])
{
int a=12;
int b=13;
modify(&a, &b);
}
void modify(int &p, int &q)
{
int *f1, *f2;
f1=p;
f2=q;
*f1 = 21;
*f2 = 31;
printf("%d%d",*f1,*f2);
}
Is it possible to pass the address parameters like the one i have shown? i know it is mistake and we need to give pointers to actually make it work? but why the above code does not work?
thanks in advance,
regards,
satya