Skip to content
Snippets Groups Projects
Commit c647f8a7 authored by Daniel Olsson's avatar Daniel Olsson
Browse files

Change dividearrays.cpp to not divide by zero

parent 02a6e840
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
int main(int argc, char **argv)
{
std::random_device generator;
std::uniform_int_distribution<int> intdist(0,50);
std::uniform_int_distribution<int> intdist(1,50);
double res[1024];
for (int i=0; i<1024; i++) {
......
......@@ -30,7 +30,7 @@ int main(int argc, char **argv)
}
while (!feof(fin)) {
getline(line, fin);
lines[cur] = (char*) malloc(strlen(line));
lines[cur] = (char*) malloc(strlen(line) + 1);
strcpy(lines[cur], line);
cur++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment