I have this piece of code (it's a samplesort algorithm with MPI in C ) which I am trying to understand but since don't know much about C I got stuck, I searched each part individually but got a bit confused. My understanding was that malloc shows where in the heap(=memory?) to save and we multiply our given numbers by the user with the sizeofint which is 4 bytes so now we have a correct allocation of memory and we cast it I guess? Though at the above line of code NoofElements are also initialized as an int (does not atoi makes the string that is argv1 which equals to first-line input by the user? ) So why do we need to cast it again?:
NoofElements = atoi(argv[1]);
Input = (int*)malloc(NoofElements * sizeof(int));
Both Input and NoofElemnts are used after in the code, but it shows a warning that they are uninitialized. Also, some other which I don't really get.