A eric@eric-VirtualBox: $ gcc employee.co test employee.c: In function 'add_employee': employee.c:46:23: warning: assign

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

A eric@eric-VirtualBox: $ gcc employee.co test employee.c: In function 'add_employee': employee.c:46:23: warning: assign

Post by answerhappygod »

A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 1
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 1 (50.8 KiB) Viewed 24 times
Code is in C
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 2
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 2 (58.15 KiB) Viewed 24 times
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 3
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 3 (58.15 KiB) Viewed 24 times
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 4
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 4 (45.94 KiB) Viewed 24 times
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 5
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 5 (53.43 KiB) Viewed 24 times
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 6
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 6 (69.7 KiB) Viewed 24 times
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 7
A Eric Eric Virtualbox Gcc Employee Co Test Employee C In Function Add Employee Employee C 46 23 Warning Assign 7 (57.26 KiB) Viewed 24 times
A eric@eric-VirtualBox: $ gcc employee.co test employee.c: In function 'add_employee': employee.c:46:23: warning: assignment to 'struct SEMPLOYEE from incompatible pointer type 'SEMP OYE LOYEE (aka 'struct employee' [-Wincompatible-pointer-types] 46 | eric@eric-VirtualBox:~ employee.c: In function 'print_employee': employee.c:64:13: warning: assignment to 'SEMPLOYEE (aka 'struct employee '} from incompatible SEMP pointer type 'struct SEMPLOYEE [-Wincompatible-pointer-types] mat 64 | trav trav->next; list->tail->next = newEmployee; A name firs employee.c: In function 'store_employee_records': ne: employee.c:79:12: warning: assignment to 'SEMPLOYEE (aka 'struct employee *} from incompatible last pointer type 'struct SEMPLOYEE [-Wincompatible-pointer-types] e ld 79 | trav trav->next; >cur d)); year /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: start': e); sa(.text+0x1b): undefined reference to 'main' star collect2: error: ld returned 1 exit status saleric@eric-VirtualBox:-$ I in function sta
[Running]-Oracle VM VirtualBox hine View Input Devices Help S Text Editor F Open 1 #include "lastnane employeerec.h" 3 #include 4 #include 5 #include 6 #include 7 8 votd enter_employee_record(SEMPLOYEE LIST *List) 9 ( 10 SEMPLOYEE *newEmployee; 11 printf("h ---Add new employee-->\n"); 12 13 14 15 16 scanf(%26s, &(newEmployee->firstName)); 17 printf ("Please enter last name:"); 18 scanf("%20s, &(newEmployee->lastName)); 19 printf("Please enter employee id: "); 20 scanf("%d", &(newEmployee->id)); 21 printf ("Please enter start year:"); 22 scanf("%4d" &(newEmployee->startYear)); 23 24 printf ("Please enter starting salary:"); scanf("%lg, 8(newEmployee->startSalary)); printf ("Please enter current salary:"); 25 20 scanf ("%lg, &(newEmployee->currentsalary)); 27 newEmployee->next = NULL; 28 29 //Add employee to list// 30 newEmployee = malloc(sizeof (SEMPLOYEE)); //allocate nenory for new employee from the heap// //poll user for employee information// printf( Please enter first name"); add employee(List, newEmployee); 31 32 return; 40 41 42 43 44 45 employee.c 33) 34 35 vold add employee (SEMPLOYEE LIST list, SEMPLOYEE *newEmployee) 36 ( 37 38 list->count++; if(list->head = NULL) ( List->head = newEmployee; list->tall= newEnployee; } else { /* add employee to tail of the list/ Type here to search O II 4 $ Jun 2 emp
intu (Running) Oracle VM VirtualBox Machine View Input Devices Help 23 printf ("Please enter starting salary:"); 24 scanf (xlg, &(newEnployee->startsalary)); 25 printf ("Please enter current salary:"); 26 scanf ("%lg. &(newEmployee->currentsalary)); 27 newEmployee->next = NULL; 20 29 //Add employee to tist// 30 31 32 33) 34 35 votd add employee (SEMPLOYEE LIST list, SEMPLOYEE newEmployee) 36 ( 37 38 39 40 (41 42 43 44 45 46 47 48 59 GO add employee (List, newEmployee); return; 01 62 63 64 65 66 list->count++; if(list->head == NULL) ( List->head newEmployee; list-stall newEmployee; } else 49 50 1 51 52 vold print employee (SEMPLOYEE LIST "list) 53 ( 54 55 SEMPLOYEE trav; 56 57 printf(Print\n"); 56 ( /* add employee to tail of the tist/ list-stall->next newEmployee; list-stall newEmployee; } return; trav list->head; while(trav t= NULL) ( printf( printf("%d, %d\n, trav->lastName, trav->firstName); printf("10: %d, Start year: $4d, Starting Salary: %lg, Current Salary: xlg, trav->td, trav-> trav trav->next; } return; 67 } 68 int store employee_records (SEMPLOYEE LIST "list) 69 ( YO 71 SEMPLOYEE trav; FILE enployeeFILE; printf("< Store\n"); Type here to search O Ï G
lg", trav->id, trav->startYear, trav->startsalary, trav->currentSalary);
59 60 61 62 63 64 65 81 82 66 67 68 int store employee_records (SEMPLOYEE LIST list) 69 ( 70 71 72 73 74 75 76 77 78 79 86 92 93 94 95 96 97 76 98 99 while(trav != NULL) printf(" "); printf("%d, %d in, trav->lastName, trav->firstName); printf("ID: %d. Start year: %4d, starting Salary: %lg, Current Salar trav trav->next; 100 101 102 103 { 184 105 106 107 108 109 83 84 tnt load employee_records (SEMPLOYEE LIST 11st) 85 ( 86 87 88 89 96 91 return; SEMPLOYEE *trav; FILE *employeeFILE; printf(" store- *>\n"); employeeFILE = fopen( employee.dat", trav list->head; while(trav != NULL) fwrite(trav, sizeof (SEMPLOYEE), 1, employeeFILE); trav = trav->next; fclose(employeeFILE); return 1; ( SEMPLOYEE *newEmployee; FILE *employeeFile; printf( -Load-\n"); employeeFile = fopen("employees.dat, "rb"); if(employeeFile != NULL) while (feof) employeeFile ==0; newEmployee = malloc(sizeof(SEMPLOYEE)); if(fread(newEmployee, sizeof(SEMPLOYEE), 1, employeeFile) > 0) add_employee(list, newEmployee); { } } fclose(employeeFile); return 1;
Open 1 #include 3 typedef struct employee 4 ( 5//char digitstring(char *string);// 6 char firstName; 7 char lastName; 8 unsigned int id; 9 int startYear; 10 double startSalary; 11 double currentsalary; 12 struct SEMPLOYEE *next; 13] SEMPLOYEE; 14 15 16 typedef struct employeelist 17 ( employee.c 18 struct employee *head; struct employee *tail; 19 20 unsigned int count; } SEMPLOYEE LIST; 21 22 23 24 vold enter_employee_record(SEMPLOYEE LIST *list); 25 void print employee_records (SEMPLOYEE LIST *list); 26 int store employee_records (SEMPLOYEE LIST *list); 27 int load employee_records (SEMPLOYEE LIST *list); 28 votd add employee (SEMPLOYEE LIST list, SEMPLOYEE *newEmployee); 29 30 SEMPLOYEE LIST employees; 31 32
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply