String overwrites every string in linked list

This is a discussion on String overwrites every string in linked list within the C Programming forums, part of the General Programming Boards category; removed...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    7

    Exclamation String overwrites every string in linked list

    removed
    Last edited by SkidMarkz; 09-12-2008 at 10:10 AM. Reason: school assignment

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Because this line:
    Code:
    new_node->make = make;
    does not, and never has, copied a string from one place to another. If you wish to copy a string from one place to another, you must use the string copy function strcpy.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  2. How can I traverse a huffman tree
    By carrja99 in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 06:46 PM
  3. Linked List
    By jpipitone in forum C Programming
    Replies: 4
    Last Post: 03-30-2003, 09:27 PM
  4. Adding To The Middle Of A Linked List
    By LostNotFound in forum C++ Programming
    Replies: 1
    Last Post: 02-23-2003, 06:02 PM
  5. Template Class for Linked List
    By pecymanski in forum C++ Programming
    Replies: 2
    Last Post: 12-04-2001, 09:07 PM

Tags for this Thread


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