Monday, 15 April 2013

c - Structure giving me "expression must be modifiable value" -


I think writing a program that keeps track of payroll records for strokes, but I think that It is understood that they understand structs that they will create a datatype and you'll use -> or to define it, but I am getting an error 2 questions,

  1. What's the problem?
  2. The program wants to add the ability to hold 1 million records, I think it is done through an array of employee structure type? Will I only send in the EMPLOYEE array in my Employee Records variable as if I

I know that "jude.name" is a problem area which is not fixed.

  #include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; # Max structure typed 1000000 {int day; Int month; Int year; } Date; Typedef struct employee {four * names [100]; Int * age; Float * Functions; Float * RegPay; Float * Oat Pe; Float * total pay; DATE PAIDAD; }Staff; Record record manager (); Int main () {Today's date; DATE TP; EMPLOYEE jude; EMPLOYEE jp; Jude.name = "jude"; System ("pause"); Return 0; }  

problem with statement ...

  Jade.name = "jude";  

... is that jude.name resolves an array (100 codes of char ). You can arrange start in announcements - and it can look confusing as an assignment - and you can assign element , but you do not specify the whole array. can do.

To keep one million records, if they should all be kept in memory at one time (as opposed to, say, in a file), then structs An array of potential choices is:

  employee employees [1000000]; Unsigned employee_count = 0;  

You can specify struct s as another type of form; The result is that specifying each field of the right-handed struct for the corresponding field of left hand is struct for example:

  EMPLOYEE one_employee; / * ... Start an employee employee ... * / employees [employee_ count ++] = an employee;  

Is there a sensible data structure for using an array, and whether this kind of assignment is conforming to your objectives depends on your program do What is the record with?

Note, you probably do not want to consider the members of your structure as indicators, except for possibly name (in which case you are definitely only an indicator Want, not one of them array):

  type-e structure employee {four names [100]; Old age; Float hours work; Float rappe; Float ot pe; Float total pay; DATE PAIDAD; } Staff;  

No comments:

Post a Comment