Arrays in C

This is a discussion on Arrays in C within the C Programming forums, part of the General Programming Boards category; I need to read three items of an array, these are in succesion but are after the first item. Would ...

  1. #1
    Unregistered
    Guest

    Arrays in C

    I need to read three items of an array, these are in succesion but are after the first item.

    Would it be best to use a pointer, and increment it accordingly, or is there another way of doing this.

    All I need is for the three items to print out in succession I do not need any rountines/calculations performing on them

  2. #2
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Unhappy

    void main()
    {
    int arr[]={1,2,3,4,5};
    int i;
    printf("\nThe 3 elements are %d %d %d",arr[1],arr[2],arr[3]);
    }

    is this what u r looking for??

    Regards,
    Sriharsha.
    Help everyone you can

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function to read in two arrays
    By ssmokincamaro in forum C Programming
    Replies: 7
    Last Post: 11-12-2008, 07:59 AM
  2. pointers & arrays and realloc!
    By zesty in forum C Programming
    Replies: 14
    Last Post: 01-19-2008, 04:24 PM
  3. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  4. Need Help With 3 Parallel Arrays Selction Sort
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2005, 10:47 PM
  5. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 09:24 PM

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