assignment question...

This is a discussion on assignment question... within the C Programming forums, part of the General Programming Boards category; I'm not sure how to approach this problem. I have an array of 40 names stored in array names[40][20]. When ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    77

    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!

    example:

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

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    Use a structure
    Code:
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    77
    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, 05: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 Cprogramming.com
    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, 08:22 PM
  5. Replies: 2
    Last Post: 12-17-2001, 05:40 PM

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