I need to pass a 2D array of int's into a function, which is normally fine, but the issue is that I don't know the last depth of the array. I know how to do it if I knew the length of the last dimension, but it is user defined. How can I do it? Also, I can't use the vector class :( Thanks in advance
mattloto
0
Light Poster
Recommended Answers
Jump to PostSince the array is user defined you must be declaring the array using dynamic memory and storing the user input as variables. Try passing the array as type int** in addition to the variables containing the user's input.
Jump to PostWell if you showed us how you declared and initialised your array, then we could tell you how to pass it to a function.
Hint: just copy/paste the original declaration into your function prototype.
All 5 Replies
Lerner
582
Nearly a Posting Maven
mattloto
0
Light Poster
Salem
5,138
Posting Sage
mattloto
0
Light Poster
mattloto
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.