Bjorn, The problem is due to the fact that CINT does not support "%p" format. Probably, I overlooked the case. If you use "%x" instead, it works. printf("nl=%x nl[0]=%d\n",nl,nl[0]); Please use %x for the time being. I'll add %p format in comming version. Masaharu Goto > > Hi Rene: > I have come accross a strange error while I was/am debugging > some code. I have been able to recreate it with the short program below. > You will notice that when I try to print out the address of the array nl > and then in the same printf statement the value of the first element of > nl I get the same number. By using different printf statements things > work just fine. Regards Bjorn > > [nilsen@vdgpce GALICE]$ root > ******************************************* > * * > * W E L C O M E to R O O T * > * * > * Version 2.00/11 28 August 1998 * > * * > * You are welcome to visit our Web site * > * http://root.cern.ch * > * * > ******************************************* > > CINT/ROOT C/C++ Interpreter version 5.13.69, Aug 22 1998 > Type ? for help. Commands must be C++ statements. > Enclose multiple statements between { }. > > WELCOME to ALICE > > Alice shared libs loaded > root [0] .x testarray.C > nl=0x866f938 nl[0]=140966200 > nl[0]=0 > nl[0]=0 > nl[1]=1 > nl[2]=2 > nl[3]=3 > nl[4]=4 > NULL > root [1] .q > [nilsen@vdgpce GALICE]$ cat testarray.C > #include <stdlib.h> > > void testarray(void){ > > int nl[5],i; > > for(i=0;i<5;i++){nl[i]=i;} > printf("nl=%p nl[0]=%d\n",nl,nl[0]); > printf("nl[0]=%d\n",nl[0]); > for(i=0;i<5;i++){printf("nl[%d]=%d\n",i,nl[i]);} > return; > } > [nilsen
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:39 MET