create a fucntion that returns an element of a struct array

lesley6369lesley6369 Member Posts: 1
Hi everyone!

I create a struct Patient and make it into a struct-array called patients. I tried to make this function returns an element of this array when

contract Doctor{

struct Patient {
uint id_p; // every patient has an id number
address id_d; // the id of this patient's corresponding doctor
string record;

Patient[] patients;// create a new struct type array of Patient

function getPatient(uint id_p) returns (Patient){

for(uint i=0;i<patients.length;i++){

if(id_p == patients[i].id_p && msg.sender == patients[i].id_d){

return patients[i];


The on-line complier said: Internal type is not allowed for public or external functions. How can I solve this problem?

Thank you so much!
Sign In or Register to comment.