Hello Andreas :-)
On Thu, Nov 3, 2011 at 12:36 AM, Andreas Fritiofson
<[email protected]> wrote:
> This won't even compile. You pass a pointer-to-int, but swd_bus_read_ack
> expects a pointer-to-pointer-to-char.
naah this is only typo in mind-shortcut, code builds well, but i dont
get it why i cannot use single pointer to pass back a memory location
to function caller... this is what pointers exist..
i have constructed this simple program to test if this can work - it
can but i need to pass a address of a variable and write value to that
variable, playing with pointers require double pointer :-( ill try
this on more complex application :-)
#include <stdlib.h>
#include <stdio.h>
int f2(int *pf21, int *pf22){
int *stuff;
stuff=(int*)calloc(1,sizeof(int));
if (!stuff) exit(-1);
*stuff=0xDEADBEEF;
printf("stuff[@%X]=%X\n", stuff, *stuff);
*pf21=stuff;
*pf22=*stuff;
return 0;
}
int f1(int *pf11, int *pf12){
return f2(pf11, pf12);
}
int main(){
int a1=0,a2=0;
f1(&a1,&a2);
printf("a1[@%X]=%X\na2[@%X]=%X\n", &a1, a1, &a2, a2);
return 0;
}
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development