TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: FRANK MASINGILL
from: HERBERT BUSHONG
date: 1998-05-12 05:41:00
subject: array of pointers

::> In the course of concentrating study of pointers I concocted the 
ollowing
::> construction:
::>       int one,two,three, four, five, six, seven;
::>       int *arrayptr[7] = {&one,&two,&three,&four,&five,&six,&seven};
::>     Evidently this is legal because my Borland Version 3 compiler doesn't
::> complain.  But then, I tried several ways to try to use these addresses 
o
::> display numbers and can't find the right combination.  I'm sure it's 
impl
::> you guys.  Please show me how I can access one of the values instead of 

Just dereference the element of the array you want the value for:
int x;
for (x=0; x < 7; x++)
   printf("value #%d is %d\n", x+1, *arrayptr[x]);
note: you might have to make that  *(arrayptr[x]) to force the correct order
(get element then dereference it). 
#  Herbert Bushong    harchon@centuryinter.net       [TEAM OS/2]    
-  Blackbeard's BBS   Intelec: 239:600/0            
+  Fido: 1:19/19      http://www.intelec.com/software/
---
   RM 1.31 2508   The Borg vs Jehovah Witness: What's the difference?
---------------
* Origin: Blackbeard's BBS - Ville Platte, LA - 318-468-3385 (1:19/19)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.