Looking for examples to insert an array?

This is a discussion on Looking for examples to insert an array? within the C++ Programming forums, part of the General Programming Boards category; Hello, I am looking for examples of inserting a value into an array on integers at a specific position in ...

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Question Looking for examples to insert an array?

    Hello,
    I am looking for examples of inserting a value into an array on integers at a specific position in the array. Is there simplified way to accomplish this?
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Code:
    int array[10];
    array[3] = 50;

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Do you mean like having an array of four items, then populating the first three, then trying to insert an item as the first one? If so, I suggest that you use a linked list. It will save you a lot of time (both writing it and running it).

  4. #4
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    teamo futbol de España tambien!

    Thanks for your inputs! It helped
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Insert value into array
    By Salgat in forum C Programming
    Replies: 6
    Last Post: 02-27-2009, 05:50 PM
  2. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  3. insert a value into an array! Help
    By letdoit in forum C++ Programming
    Replies: 3
    Last Post: 05-29-2004, 09:41 PM
  4. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 11:09 AM
  5. Creating 2D arrays on heap
    By sundeeptuteja in forum C++ Programming
    Replies: 6
    Last Post: 08-16-2002, 11:44 AM

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