heap - Using arrow -> and dot . operators together in C -


i under impression possible access data sub-node of linked list or similar structure using arrow , dot operators so:

typedef struct a{ int num; struct *left; struct *right; }tree;  tree *sample; ... if(sample->left.num > sample->right.num)     //do 

but when try implement this, using -> , . access data sub node error "request member num in not structure or union".

use -> pointers; use . objects.

in specific case want

if (sample->left->num > sample->right->num) 

because of sample, sample->left, , sample->right pointers.

if convert of pointers in pointed object; use . instead

struct copyright; copyright = *(sample->right); // if (sample->left->num > copyright.num) if (*(sample->left).num > copyright.num) 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -