Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Can array elements have different data types?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 22-02-2012
Member
 
Join Date: Jan 2012
Posts: 12
Can array elements have different data types?
  

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

Reply With Quote
  #2  
Old 22-02-2012
Member
 
Join Date: Jun 2006
Posts: 620
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'";
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Can array elements have different data types?"
Thread Thread Starter Forum Replies Last Post
Slow data transfer from Wd Elements disk Druvan Hardware Peripherals 5 12-07-2011 07:34 PM
Unable to find elements of a given type in an array in C# Kasper Software Development 4 09-02-2010 06:46 PM
Different types of data bus in computer CAILYN Hardware Peripherals 5 29-01-2010 06:39 AM
How to add data from Array to a Datagrid? Karsenman Software Development 5 19-01-2010 10:20 AM


All times are GMT +5.5. The time now is 03:36 AM.