TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Carl
NA
11
0
Passing subarrays as parameter
Jun 11 2007 7:43 AM
Dear community,
How do I pass a subarray from a multidimensional array as a parameter to a function?
In c the code would be like:
int array[5][5];
array[3][1]= 3;
dosomething(array[3]); // passes the 4th subarray to the function
Declared as:
void dosomething(int[]);
How will the port to c# look like?
int[][] array= new array[5][5]; // syntax error
int[][] array= new array[5,5]; // compile error: cannot cast [,] implicitely to [][]
int[,] array= new array[5,5];
array[3][1]= 3;
dosomething(array[3]); // compile error, 2 dimensions expected
Can someone help me out?
Thanks,
Carl
Reply
Answers (
2
)
write to file with line breaker
Novice Problem6