Thread: New pointer locations

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    1

    New pointer locations

    Hey everyone I am new to this board and to C.

    Alright I have a programming assignment doing analytics on text files. This problem is driving me crazy. Ok I have array of a structure to store the string and the number of occurrences that it appears in the text file. PROBLEM: While in the main loop of storing data in the array of structures i need to get a new memory location to store the string. It keeps writing over the memory location. I know why it is doing it, but i do not know how to work around this problem without making a huge array. efficiency is necessary

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Show us your code!
    None of us is a mind reader...

    << !! Posting Code? Read this First !! >>

  3. #3
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Sounds like a static array implementation; dynamically allocate arrays with malloc() instead.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer to a function pointer
    By @nthony in forum C Programming
    Replies: 3
    Last Post: 05-30-2010, 05:13 PM
  2. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  3. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 03:47 PM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM