I added the section at the bottom from "intmain" to "printf", and it still will not compile. Any ideas?
I added the section at the bottom from "intmain" to "printf", and it still will not compile. Any ideas?
You can't just stick "int main" inside another function.
And you haveYour assignment is to finish the following functions
printBoxList(float boxes[MAX_BOXES][6], int n);
writeBoxesToFile(char fileName[],float boxes[MAX_BOXES][6], int n);
Do you understand what you're supposed to be doing here?Code:void writeBoxesToFile(char fileName[], float boxes[MAX_BOXES][6], int n) { FILE *fp; fp = fopen(fileName, "w"); if (fp == NULL){ printf("unable to open file for writing\n"); return; } fprintf(fp, "%d\n", n); fclose(fp); } /* finish this function to print a table of the box coordinates Make sure to label the columns */ void printBoxList(float boxes[MAX_BOXES][6], int n) int main() { int row int column for (row= -1; row<n; ++row) for(column=-1; column<6; ++column) } { printf("printBoxList,[row],[column]\n");
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.
I guess not, I thought I was to finish the bottom part of the source code, which I thought I did, I haven't figured out how to label yet but It should still run the way I have it .
There is no main() in that source file (did you read the instructions?)
All you're supposed to do is
You can "label the columns" later.Code:void writeBoxesToFile(char fileName[], float boxes[MAX_BOXES][6], int n) { FILE *fp; fp = fopen(fileName, "w"); if (fp == NULL){ printf("unable to open file for writing\n"); return; } fprintf(fp, "%d\n", n); /* YOUR CODE HERE */ fclose(fp); } /* finish this function to print a table of the box coordinates Make sure to label the columns */ void printBoxList(float boxes[MAX_BOXES][6], int n) { /* YOUR CODE HERE */ }
Try just getting something to print out the basic information.
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.