Thread: Dynamic array?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    93

    Dynamic array?

    I have to use a dynamic array and don't have a clue how to start this. The array is empty unless the user decides to input a number in it. I was thinking this but I am not sure of this will will work.

    Code:
    #include <stdio.h>
    
    int main ( void )
    
    int SIZE = 0, a [ ], menu;
    
    
    printf("Press one if you would like to add an intenger\n");
    scanf("%d",&menu);
    
    if ( menu == 1 ) {
    SIZE++
    scanf("%d",&int[SIZE]
    
    )
    printf("What number would you like to delete\n");
    scanf("%d",&key);
    call linear search function
    delete key; ( not sure how to do that )
    call copy function to copy array a;

    Any ideas are greatly appreciated.

    Thanks.
    Last edited by Salem; 06-30-2008 at 11:27 AM. Reason: fix code tags, for all the good it did.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic Array Resizing
    By dld333 in forum C++ Programming
    Replies: 13
    Last Post: 11-04-2005, 12:13 AM
  2. need help with dynamic array syntax
    By soldyne in forum C Programming
    Replies: 3
    Last Post: 10-11-2005, 01:59 PM
  3. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  4. 2D dynamic array problem
    By scsullivan in forum C Programming
    Replies: 3
    Last Post: 12-30-2002, 10:02 PM
  5. Dynamic array allocation and reallocation
    By purple in forum C Programming
    Replies: 13
    Last Post: 08-01-2002, 11:48 AM