| | |
very short code question plz help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 16
Reputation:
Solved Threads: 0
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
{
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
The Right hand value over here in
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
Hope this solves it out.
C++ Syntax (Toggle Plain Text)
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
C++ Syntax (Toggle Plain Text)
#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.
![]() |
Similar Threads
- Need help with 8086 assembly language (Assembly)
- Jni (Java)
Other Threads in the C++ Forum
- Previous Thread: End Of File (ifstream)
- Next Thread: limitation of arrays
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






