Need Help Fast!!!!!!

This is a discussion on Need Help Fast!!!!!! within the C Programming forums, part of the General Programming Boards category; Ok i have a binary search tree. In each node there is a space for a char *word. it is ...

  1. #1
    Rec-E
    Guest

    Need Help Fast!!!!!!

    Ok i have a binary search tree. In each node there is a space for a char *word. it is a pointer to dynamically allocated storage. Now in one function i extract a word from a sentence and store in allocated storage. then i try to pass that value into a function so i can copy it into a node in the tree. How do i pass that value in the funtion call. Right now my prototype look like
    functionname(char word[], bst t)
    im thinking that the char word is not right because it is allocated storage. what do i do? i hope i was clear about my problem.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Assuming that char word[] in the function call is different from the char *word in your node, it doesn't matter how you handle the word that you pass to the function since you aren't assigning to it or modifying it, you're just copying it. Once you extract the word from the file or input, you can copy it to the node easily. Just be sure that you hafve space allocated in the node for the word you plan to copy.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fast image crop
    By stabu in forum C Programming
    Replies: 5
    Last Post: 04-23-2009, 03:07 PM
  2. Replies: 6
    Last Post: 02-27-2009, 03:43 PM
  3. Saving a part of screen into a file fast!
    By Zap in forum C++ Programming
    Replies: 4
    Last Post: 06-28-2003, 10:56 AM
  4. Super fast bilinear interpolation
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 06-18-2002, 09:35 PM
  5. moving a bitmap, fast and smooth
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 05-31-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21