C MPI

#include <stdio.h>
#include <time.h>
#include <mpi.h>
#include <stdlib.h>

int main(int argc, char **argv){
int x, i, temp;
int node, size;
double t1,t2;
double dif;

MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &node);
MPI_Comm_size(MPI_COMM_WORLD, &size);

t1=MPI_Wtime();

const int MAX_ELEMENTS = 100000;

int MP_MAX_ELEMENTS = MAX_ELEMENTS/size; //div list size
int list[MP_MAX_ELEMENTS];

// generate random numbers and fill them to the list
for(x = 0; x < MP_MAX_ELEMENTS; x++ ){
list[x] = rand() % 10000000;
printf("Random generate number %d from node %d \n", list[x], node);
};

//find the largest number
temp = list[0];

for(i = 1;i<x;i++) {
if(temp < list[i])
temp = list[i];
} ;
printf("The highest number from node %d = %d ", node, temp);

t2=MPI_Wtime();
dif = difftime (t2,t1);
printf("time: %f\n",dif);

};


Hi I received error Error C2143 line 18, 20, 21 missing ";" and error 2065 undeclared list and MP_MAX_ELEMENTS where I not sure whats wrong
Topic archived. No new replies allowed.