int patientstomemory(patientstruct (*patientstructpointer)[maxpatients])
{
    patientstruct patientstruct1[maxpatients];
    patientstruct1= (*patientstructpointer);

1>c:\documents and settings\patrick\my documents\hgkbklhb\hgkbklhb\hgkbklhb.cpp(88) : error C2106: '=' : left operand must be l-value

whats wrong? very important, working on semester project due monday

Recommended Answers

All 3 Replies

The Right hand value over here in

patientstruct1= (*patientstructpointer);

Is an error because a the stucture is taking in values from a pointer, which is not allowed.
An example program is written below so that it may help you in solving your problem

#include <iostream>

using namespace std;

int main()
{
    struct sky{
           char a;
           int b;
           };
                      
        sky art;//Object
        sky *start;
        
        art.a='s';
        art.b=9;
        
        
        *start=art;//Pointer is pointing to art which is legal.
        
        sky mart;
        
        //*start=mart; // This is illegal in c++ and produces the error.
       

     //Therefore pass values in this way
       
        mart.a=start->a;
        mart.b=start->b;
        
        
        cout<< mart.a<<"\n\a"<<mart.b<<"\a";
        cin.get();
        return 0;
}

Hope this solves it out.

oh may the programming gods bless you
now i know whats wrong ill try to figure out how to do it

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.