Thread: assignment question...

  1. #1
    Registered User
    Join Date
    Dec 2004

    assignment question...

    I'm not sure how to approach this problem. I have an array of 40 names stored in array names[40][20]. When I print the names out to a file I need to change them to a different name. Is there a way to associate the current name to the printed name?

    Thank you!


    current name printed name
    hot rod rodster
    coupe hardtop
    convertible ragtop
    bigblock largemtr
    . .
    . .
    . .
    and so on
    Last edited by jerrykelleyjr; 10-31-2006 at 06:42 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Use a structure
    struct {
       char currentname[20];
       char printedname[20];
    } names[40];
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2004
    thanks...I should have thought of it!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using swap to make assignment operator exception safe
    By George2 in forum C++ Programming
    Replies: 9
    Last Post: 01-10-2008, 06:32 AM
  2. array assignment question
    By threahdead in forum C Programming
    Replies: 2
    Last Post: 08-17-2003, 05:36 PM
  3. Question...
    By TechWins in forum A Brief History of
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  5. Replies: 2
    Last Post: 12-17-2001, 06:40 PM