pass a address of pointer.

void insert(bst **head, int data);

call it using insert(&record,8).

try this.
On Thu, Jan 27, 2011 at 4:47 PM, nishaanth <[email protected]> wrote:

> Hi guys,
>
> I have a small doubt regarding pointers and functions.
>
> Consider the following prototype
>
> void insert(bst * head, int data);
>
> This function creates a node and inserts the data in the node. Lets say i
> call this function iteratively from main.
>
> main(){
>
> bst* record=NULL;
> insert(record, 5);
> insert(record, 8);
>
> }
>
> I see that record is not getting modified. Now is this related to call by
> value. But since we are passing pointers shouldnt the change get reflected
> in main.
> isnt is similar to passing an array?
> Enlighten me in this regard. I am tired of segfaults :(
>
>
> Regards,
> S.Nishaanth,
> Computer Science and engineering,
> IIT Madras.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to