Question: //Error message: [Error] expected declaration specifiers or '...' before 'time' //My exact code is pasted below. I cant figure out why srand isnt working. Ignore
//Error message: "[Error] expected declaration specifiers or '...' before 'time'"
//My exact code is pasted below. I cant figure out why srand isnt working. Ignore what ive commented out as I havent started working on that yet.
#include "stdio.h"
#include "time.h"
#include "stdlib.h"
#define N 10
void print_array2(double array[], int length);
//void bubble_sort(double array[], int length, in order);
//void insertion_sort(double array[], int length);
int i;
srand(time(0));
void main(){
double array1[N];
double array2[N];
double array3[N];
for(i=0; i array1[i] = rand() % 200 - 100; array2[i] = rand() % 200 - 100; array3[i] = rand() % 200 - 100; } print_array2(array1,N); print_array2(array2,N); print_array2(array3,N); /* bubble_sort(array1,N,0); bubble_sort(array2,N,1); insertion_sort(array3,N); print_array2(array1,N); print_array2(array2,N); print_array2(array3,N); */ } void print_array2(double array[], int length){ for(i=0; i printf("%d ", array[i]); } printf(" "); } ![//Error message: "[Error] expected declaration specifiers or '...' before 'time'" //My exact](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2c8afe7aba_11966f2c8af4c1d6.jpg)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
