how can I convert array<int^>^ to int*?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think it will be hard to directly convert
array<int^>^into anint*, because it is an array of references to ints, not an array of ints. There is no promises about the memory layout of the integers themselves, which is required in order to get them to a plain old C/C++ array.I think that the easiest way to go is to make a copy of the array, pass it to
f(int* input)and then possibly copy the data back if it is modified by f.