| delorie.com/archives/browse.cgi | search |
| From: | balboa <balboa AT castle DOT on DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Newbie looking for clarity |
| Date: | Wed, 17 Feb 1999 12:19:41 -0500 |
| Organization: | UUNET Canada News Transport |
| Lines: | 65 |
| Message-ID: | <36CAFA2D.DEDDF0BF@castle.on.ca> |
| NNTP-Posting-Host: | 209.47.203.66 |
| Mime-Version: | 1.0 |
| X-Mailer: | Mozilla 4.5 [en] (WinNT; U) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
--------------6DDB104BBC2D8856C63F4C7D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
This a question for clarity.
int array_name[10];
If the name of the array array_name points to the address of the first
element of the array.
array_name[0];
struct item
{
int value;
char name[20];
};
struct item list;
Is it the same for this structure, the name list points to the address
of first element of the structure?
If this is true then list.value is a pointer to the value.
struct item *list_ptr;
list_ptr = (struct item *) malloc(sizeof(struct item));
Then list_ptr points to the element of the structure in memory.
If this is true then list->value is a pointer to the value.
Dave
--------------6DDB104BBC2D8856C63F4C7D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
This a question for clarity.
<p><b>int array_name[10];</b>
<p>If the name of the array array_name points to the address of the first
element of the array.
<p> <b>array_name[0];</b>
<p><b>struct item</b>
<br><b>{</b>
<br><b> int value;</b>
<br><b> char name[20];</b>
<br><b>};</b>
<p><b>struct item list;</b>
<p>Is it the same for this structure, the name<b> list</b> points to the
address of first element of the structure?
<p>If this is true then <b>list.value</b> is a pointer to the value.
<p><b>struct item *list_ptr;</b>
<p><b>list_ptr = (struct item *) malloc(sizeof(struct item));</b>
<p>Then <b>list_ptr</b> points to the element of the structure in memory.
<p>If this is true then <b>list->value</b> is a pointer to the value.
<p>Dave</html>
--------------6DDB104BBC2D8856C63F4C7D--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |