Results 1 to 2 of 2

Thread: Can array elements have different data types?

  1. #1
    Join Date
    Jan 2012
    Posts
    12

    Can array elements have different data types?

    Can array elements have different data types? Can someone please explain?

  2. #2
    Join Date
    Jun 2006
    Posts
    623

    Re: Can array elements have different data types?

    Well, if we specified a type when declaring an array then we can't use multiple datatype for that array.

    Check for an instance the below example ->


    int[] arr = new int[5];

    arr[0] = 9;

    arr[1] = 45;

    arr[2] = "66";


    Then it gives Error as -> "Cannot implicitly convert type 'string' to 'int'";

Similar Threads

  1. Slow data transfer from Wd Elements disk
    By Druvan in forum Hardware Peripherals
    Replies: 5
    Last Post: 12-07-2011, 07:34 PM
  2. Unable to find elements of a given type in an array in C#
    By Kasper in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 06:46 PM
  3. Different types of data bus in computer
    By CAILYN in forum Hardware Peripherals
    Replies: 5
    Last Post: 29-01-2010, 06:39 AM
  4. How to add data from Array to a Datagrid?
    By Karsenman in forum Software Development
    Replies: 5
    Last Post: 19-01-2010, 10:20 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,554,813.79780 seconds with 17 queries