Ques. Write a constraint for a dynamic array with the address between 200 to 300 with a data b/w 50 to 100 randomly generated. [Using only One Constraint]
Please show us what you have tried.
Here I have one doubt we are not constraining the address.
Can you please check it?
@dave_59
There is no dynamic array in the code you showed us, There is a fixed size array (101 elements) with an addressable range between 200 and 300.
Can you please tell the correct way of doing it ?
Its an interview question.
@dave_59
The correct way of handling this is asking the interviewer questions when you don’t understand how to answer. Do they mean array addresses 200 to 300 need to be constrained to have the value 50 to 100, or did they mean to say the size of the array is randomly between 200 to 300, and all array addresses need to have data between 50 to 100?
He wants array address to be in 200 to 300 but in dynamic array how to do it?
That I don’t know.
Dynamic arrays start at address/index 0 and go up to array.size()-1. Either you are misinterpreting the question, or they are are not asking using the correct terminology.