954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C, decrement struct 2d array pointed to by struct pointer

I have the following struct deceleration and I would like to decrement eq->pt_tree[c][r], the row portion of pt_tree[c][r] using pointer subscript. How can I do this?

struct eq_values{
   int * pt_tree[2];
}; 
eq->pt_tree[i] = (int *) malloc(12 * sizeof (int));

I think it will look like the following, but this is not it

*(eq->pt_tree[c])--;
mike.bauer
Newbie Poster
6 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

Try --(*eq->pt_tree[c]); .

deceptikon
Indubitably
Administrator
632 posts since Jan 2012
Reputation Points: 119
Solved Threads: 105
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You