User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,485 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,193 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 180 | Replies: 3
Reply
Join Date: May 2008
Posts: 16
Reputation: GigaCorp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
GigaCorp GigaCorp is offline Offline
Newbie Poster

very short code question plz help

  #1  
May 10th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,638
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 22
Solved Threads: 418
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: very short code question plz help

  #2  
May 10th, 2008
You can't assign a whole array, you need to copy it one entry at a time.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Join Date: Mar 2008
Posts: 231
Reputation: Sky Diploma is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 32
Sky Diploma's Avatar
Sky Diploma Sky Diploma is offline Offline
Posting Whiz in Training

Re: very short code question plz help

  #3  
May 10th, 2008
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

  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. struct sky{
  8. char a;
  9. int b;
  10. };
  11.  
  12. sky art;//Object
  13. sky *start;
  14.  
  15. art.a='s';
  16. art.b=9;
  17.  
  18.  
  19. *start=art;//Pointer is pointing to art which is legal.
  20.  
  21. sky mart;
  22.  
  23. //*start=mart; // This is illegal in c++ and produces the error.
  24.  
  25.  
  26. //Therefore pass values in this way
  27.  
  28. mart.a=start->a;
  29. mart.b=start->b;
  30.  
  31.  
  32. cout<< mart.a<<"\n\a"<<mart.b<<"\a";
  33. cin.get();
  34. return 0;
  35. }

Hope this solves it out.
User, n. The word computer professionals use when they mean "idiot." ~Dave Barry
Reply With Quote  
Join Date: May 2008
Posts: 16
Reputation: GigaCorp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
GigaCorp GigaCorp is offline Offline
Newbie Poster

Re: very short code question plz help

  #4  
May 10th, 2008
oh may the programming gods bless you
now i know whats wrong ill try to figure out how to do it
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 4:41 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC