c - returning address form a function -


i have returned address form function search(keys),

return ptr->keys[pos] 

where ptr->keys[pos].value used access member function of keys. above return statement correct? return address after returns have done

struct classifier keys,temp,*temp_ptr; temp = search(key); temp_ptr = &temp; 

and accessing member function value of keys as

temp->value 

from you've said, if pos 0 or 1 it's valid index in keys , return statement is ostensibly correct. please post realistic code though: question's "struct classifier keys,..." not reconcilable "struct classifier keys[2]" mentioned in comment above. following code not correct: temp = search(key); tries copy pointer structure. might mean temp = *search(key), copy struct classifier's content out. can use temp.value or temp_ptr->value not temp->value asked.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -