3
answers
0
watching
87
views
brmLv1
3 Apr 2023
Hi. Thank you for responding and provinding your code. I am using a free online compiler and this was the result. If you could rectify these errors that would help lots. Thx.
main.c: In function ‘encrypt_caesar_cipher’:
main.c:32:13: warning: implicit declaration of function ‘isalpha’ [-Wimplicit-function-declaration]
32 | if (isalpha(c)) {
| ^~~~~~~
main.c:5:1: note: include ‘’ or provide a declaration of ‘isalpha’
4 | #include <time.h>
+++ |+#include <ctype.h>
5 |
main.c:33:25: warning: implicit declaration of function ‘isupper’ [-Wimplicit-function-declaration]
33 | char base = isupper(c) ? 'A' : 'a';
| ^~~~~~~
main.c:33:25: note: include ‘’ or provide a declaration of ‘isupper’
main.c: In function ‘create_random_item’:
main.c:75:20: warning: implicit declaration of function ‘generate_barcode’ [-Wimplicit-function-declaration]
75 | item.barcode = generate_barcode(&item);
| ^~~~~~~~~~~~~~~~
main.c: At top level:
main.c:80:6: error: redefinition of ‘create_random_item’
80 | Item create_random_item() {
| ^~~~~~~~~~~~~~~~~~
main.c:48:6: note: previous definition of ‘create_random_item’ with type ‘Item()’
48 | Item create_random_item() {
| ^~~~~~~~~~~~~~~~~~
main.c: In function ‘create_random_item’:
main.c:96:16: error: ‘Item’ has no member named ‘manufacturer’
96 | strcpy(item.manufacturer, manufacturers[manufacturer_index]);
| ^
main.c: At top level:
main.c:129:6: error: redefinition of ‘encrypt_caesar_cipher’
129 | void encrypt_caesar_cipher(char *input, int key, char *output) {
| ^~~~~~~~~~~~~~~~~~~~~
main.c:28:6: note: previous definition of ‘encrypt_caesar_cipher’ with type ‘void(char *, int, char *)’
28 | void encrypt_caesar_cipher(char *input, int key, char *output) {
| ^~~~~~~~~~~~~~~~~~~~~
main.c:144:15: error: conflicting types for ‘generate_barcode’; have ‘long unsigned int(Item *)’
144 | unsigned long generate_barcode(Item *item) {
| ^~~~~~~~~~~~~~~~
main.c:75:20: note: previous implicit declaration of ‘generate_barcode’ with type ‘int()’
75 | item.barcode = generate_barcode(&item);
| ^~~~~~~~~~~~~~~~
main.c: In function ‘generate_receipt’:
main.c:166:5: warning: implicit declaration of function ‘print_receipt’ [-Wimplicit-function-declaration]
166 | print_receipt(&receipt);
| ^~~~~~~~~~~~~
main.c: In function ‘main’:
main.c:174:9: warning: implicit declaration of function ‘apply_discounts’ [-Wimplicit-function-declaration]
174 | apply_discounts(&items[i], time(NULL));
| ^~~~~~~~~~~~~~~
Hi. Thank you for responding and provinding your code. I am using a free online compiler and this was the result. If you could rectify these errors that would help lots. Thx.
main.c: In function ‘encrypt_caesar_cipher’: main.c:32:13: warning: implicit declaration of function ‘isalpha’ [-Wimplicit-function-declaration] 32 | if (isalpha(c)) { | ^~~~~~~ main.c:5:1: note: include ‘’ or provide a declaration of ‘isalpha’ 4 | #include <time.h> +++ |+#include <ctype.h> 5 | main.c:33:25: warning: implicit declaration of function ‘isupper’ [-Wimplicit-function-declaration] 33 | char base = isupper(c) ? 'A' : 'a'; | ^~~~~~~ main.c:33:25: note: include ‘’ or provide a declaration of ‘isupper’ main.c: In function ‘create_random_item’: main.c:75:20: warning: implicit declaration of function ‘generate_barcode’ [-Wimplicit-function-declaration] 75 | item.barcode = generate_barcode(&item); | ^~~~~~~~~~~~~~~~ main.c: At top level: main.c:80:6: error: redefinition of ‘create_random_item’ 80 | Item create_random_item() { | ^~~~~~~~~~~~~~~~~~ main.c:48:6: note: previous definition of ‘create_random_item’ with type ‘Item()’ 48 | Item create_random_item() { | ^~~~~~~~~~~~~~~~~~ main.c: In function ‘create_random_item’: main.c:96:16: error: ‘Item’ has no member named ‘manufacturer’ 96 | strcpy(item.manufacturer, manufacturers[manufacturer_index]); | ^ main.c: At top level: main.c:129:6: error: redefinition of ‘encrypt_caesar_cipher’ 129 | void encrypt_caesar_cipher(char *input, int key, char *output) { | ^~~~~~~~~~~~~~~~~~~~~ main.c:28:6: note: previous definition of ‘encrypt_caesar_cipher’ with type ‘void(char *, int, char *)’ 28 | void encrypt_caesar_cipher(char *input, int key, char *output) { | ^~~~~~~~~~~~~~~~~~~~~ main.c:144:15: error: conflicting types for ‘generate_barcode’; have ‘long unsigned int(Item *)’ 144 | unsigned long generate_barcode(Item *item) { | ^~~~~~~~~~~~~~~~ main.c:75:20: note: previous implicit declaration of ‘generate_barcode’ with type ‘int()’ 75 | item.barcode = generate_barcode(&item); | ^~~~~~~~~~~~~~~~ main.c: In function ‘generate_receipt’: main.c:166:5: warning: implicit declaration of function ‘print_receipt’ [-Wimplicit-function-declaration] 166 | print_receipt(&receipt); | ^~~~~~~~~~~~~ main.c: In function ‘main’: main.c:174:9: warning: implicit declaration of function ‘apply_discounts’ [-Wimplicit-function-declaration] 174 | apply_discounts(&items[i], time(NULL)); | ^~~~~~~~~~~~~~~6 Apr 2023
Read by 1 person