The following C program would seem to be ok...
#include <stdlib.h>
void assign(char *a, char **b)
{
*b = a;
}
int main() {
char *a = "test";
char *b = NULL;
assign(a,&b);
puts(a);
puts(b);
return 0;
}
while the following root sequenence isn't.
root [0] .L qq3.C
root [1] char *a = "test"
root [2] char *b
root [3] b
(char* 0x0)""
root [4] a
(char* 0x40aad8)"test"
root [5] assign (a,&b)
*** Break *** segmentation violation
where qq3.C is:
void assign(char *a, char **b)
{
*b = a;
}
Could someone point out what I'm doing wrong? Sorry if this is simple,
I just don't see it :-)
Thanks!
bruce
--Bruce O'Neel phone: +41 22 950 91 22 (direct) INTEGRAL Science Data Centre +41 22 950 91 00 (switchb.) Chemin d'Ecogia 16 fax: +41 22 950 91 33 CH-1290 VERSOIX e-mail: Bruce.Oneel@obs.unige.ch Switzerland WWW: http://obswww.unige.ch/isdc/