Hello,
 
Please, it would like to know as to get in OCaml the value of the address of memory of a pointer, as it occurs in the example in C that follows:

Code:
void main()
{
   int my_array[] = {1, 23, 17};
   int *ptr;
   int i;
 
   ptr = &my_array[0];         /* point  to the first element of the array */
   for (i = 0; i < 3; i++) {
      printf("\nvalue of my_array[%d] = %d; ", i, my_array[i]);
      printf("value of ptr + %d = %d\n",i, *(ptr + i));
      printf("address of my_array[%d] = %x; ", i, &my_array[i]);
      printf("address of ptr = %x\n", (ptr + i));
}
 
Result:
value of my_array[0] = 1; value of ptr + 0 = 1
address of my_array[0] = 12ff80; address of ptr = 12ff80
 
value of my_array[1] = 23; value of ptr + 1 = 23
address of my_array[1] = 12ff84; address of ptr = 12ff84
 
value of my_array[2] = 17; value of ptr + 2 = 17
address of my_array[2] = 12ff88; address of ptr = 12ff88
 
Thanks,
 
André
 




Yahoo! Mail - O melhor e-mail do Brasil. Abra sua conta agora!