please any onr explain this line

Posted by Gow.Net under C# on 4/16/2012 | Points: 10 | Views : 740 | Status : [Member] | Replies : 9

int len = str.Length;
char[] arr = new char[len];

please any one explain char[] arr = new char[len]; meaning

gowthaman8870226416


Responses

Posted by: Sabarimahesh on: 4/16/2012 [Member] Bronze | Points: 25

Up
0
Down
String Str ="sss"
int len = str.Length;/// Now len is len=3

char[] arr = new char[len]; //// Now char[] arr = new char[3]..

if this is not a answer.....

Please... Say ur question Clearly...

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: dhirenkaunar-15094 on: 4/16/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Gowthaman,

In the below code is trying to create a character array of the length of the available string .

example :
string str="gowthaman";
// now str length is 9
int len = str.Length;
char[] arr = new char[len];
Console.WriteLine("Length="+arr.Length); // it will return Length=9
This is creating an empty array with length=9.


Thanks & Rgards,
Dhiren Kumar Kaunar

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.Net on: 4/16/2012 [Member] Starter | Points: 25

Up
0
Down
thank you

gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: karunakar5788-15015 on: 4/16/2012 [Member] Starter | Points: 25

Up
0
Down
hi goutham..


here str.lengh takes String length..


string str="Team India";

int len = str.Length;//len=10
char[] arr = new char[len];//we are try create character arry.
console.writeln("length of array"+arr.length);

we can convert string into character arry..
now in this charcter arry we can get one by one..element


Karunakar

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/16/2012 [Member] Bronze | Points: 25

Up
0
Down
gowthaman

Haave you Satisfied with my answer i posted

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/16/2012 [Member] Bronze | Points: 25

Up
0
Down

gowthaman

if you Got a Answer...

Please mark as Answer


Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/16/2012 [Member] Silver | Points: 25

Up
0
Down
hi gowtham,

char[] arr = new char[len];

this is the array declaration..

that array length is passed by variable 'len'....

Regards,
Singaravel M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: dhirenkaunar-15094 on: 4/16/2012 [Member] Starter | Points: 25

Up
0
Down
hi gowtham,
If you satisfied with my answer i post , please mark as answer.

Thanks & Rgards,
Dhiren Kumar Kaunar

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/16/2012 [Member] Bronze | Points: 25

Up
0
Down
hi gowtham,
If you satisfied with my answer i post , please mark as answer.

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response