Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing Structure Elements in a Function
    primarykey
    data
    text
    <p>when I compile the code below, I'm presented with the errors</p> <pre><code>snippet.c:24:24: error: request for member ‘px’ in something not a structure or union snippet.c:25:24: error: request for member ‘py’ in something not a structure or union snippet.c:27:22: error: request for member ‘x’ in something not a structure or union snippet.c:27:45: error: request for member ‘y’ in something not a structure or union snippet.c:31:14: error: request for member ‘x’ in something not a structure or union snippet.c:35:16: error: request for member ‘y’ in something not a structure or union snippet.c:39:25: error: request for member ‘px’ in something not a structure or union snippet.c:40:25: error: request for member ‘py’ in something not a structure or union </code></pre> <p>for the code below</p> <pre><code>struct list{ int x; int y; int f; int g; int h; int px; int py; }; void history(int j, struct list *path[], struct list *closelist[], struct list *start, int *fxele); void history(int j, struct list *path[], struct list *closelist[], struct list *start, int *fxele){ int i, p; path[0] = closelist[j]; p = 1; struct list tempsq; tempsq.x = (*closelist).px[j]; tempsq.y = (*closelist).py[j]; while(tempsq.x=!start.x &amp;&amp; tempsq.y =! start.y){ for(i = 0; i &lt;= *fxele; i++){ if(closelist.x[i] = tempsq.x){ for(j = 0; j &lt;= *fxele; j++){ if(closelist.y[j] = tempsq.y){ path[p] = closelist[j]; p = p+1; tempsq.x = closelist.px[j]; tempsq.y = closelist.py[j]; } } } } } return; } </code></pre> <p>The code is meant to trace back the parents of squares for a pathfinding system, but the specifics aren't important. I'm curious as to what is wrong with how I'm calling 'closelist' and 'start' that is preventing me from calling their structure elements.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload