I keep getting an "expected identifier" error on this part of my code
Code:struct InventoryData =={0,"",0};
where I don't believe there is any actual issue. I'm using repl.it to write it. This is the only thing blocking me from running my code.
I keep getting an "expected identifier" error on this part of my code
Code:struct InventoryData =={0,"",0};
where I don't believe there is any actual issue. I'm using repl.it to write it. This is the only thing blocking me from running my code.
Last edited by maxx96; 11-24-2018 at 07:41 AM. Reason: missed code
[/COLOR]Code:void newItem(FILE * fPtr) { printf("%s", "Enter new item number(1-100): "); unsigned int productNum; scanf("%d", &productNum); fseek(fPtr, (productNum - 1) * sizeof(struct InventoryData), SEEK_SET); struct InventoryData == { 0, "", 0 }; fread(&product, sizeof(struct InventoryData), 1, fPtr); if (product.productCode != 0) { printf("Account #%d already contains information. \n", product.productCode); } else { printf("%s", "Enter product name and product balance\n?"); scanf("%15s%d", &product.productName, &product.productBalance); product.productCode = productNum; fseek(fPtr, (productNum - 1) * sizeof(struct InventoryData), SEEK_SET); fwrite(&product, sizeof(struct InventoryData), 1, fPtr); } }
[/FONT][/COLOR]
This isn't all of my code but it's the function that the error is in. Hope this helps.
Last edited by Salem; 11-24-2018 at 08:28 AM. Reason: Removed crayola
I still can't see the details of the struct, that is probably in a .h file, nor can I compile the program to see this and any other warnings or errors.
PLEASE, PLEASE, make sure you are posting PLAIN TEXT code. I can hardly read the code with all the color, and faded font!
Can you provide a small program that demonstrates the error, if not the whole program?
You seem to be using == instead of =, in your attempt at structure assignment.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.