Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
Krasimir committed Nov 25, 2024
1 parent fd8d9d6 commit 6387a79
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion assignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
int rows = atoi(argv[1]);
int cols = atoi(argv[2]);

if (rows != 5 || cols != 10) { // Ensure the dimensions match the test expectations
if (rows != 5 || cols != 10) {
printf("Incorrect usage. Expected dimensions are 5 rows and 10 columns\n");
return 1;
}
Expand Down
4 changes: 0 additions & 4 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#define NCOLS 10

int main(int argc, char *argv[]) {
// testing ./assignment NROWS NCOLS
FILE *f;
char line[256];
char *token;
Expand All @@ -19,14 +18,11 @@ int main(int argc, char *argv[]) {
}

int nrows = 0, ncols = 0;
// Read the file line by line
while (fgets(line, sizeof(line), f) != NULL) {
// Remove the newline character at the end of the line (if present)
line[strcspn(line, "\n")] = 0;

nrows++;

// Tokenize the line using whitespace as the separator
ncols = 0;
token = strtok(line, " \t");
while (token != NULL) {
Expand Down

0 comments on commit 6387a79

Please sign in to comment.