私はLinuxでCを書いていて、親とN人の子をフォークしています。親はsqrt(ArraySize)を取り、残りはN個の子に均等に分割されます。
配列の残りの部分をN個の子に均等に分割するにはどうすればよいですか?\
事前にThnx:)
int arraySize = 100; // You would get a count from the array here
int nChildren = 5; // This would be provided by you as a parameter to this function
int parentSize = sqrt(arraySize);
int remainder = arraySize - parentSize;
int nChildSize = (remainder / nChildren) + 1
あなたは完全な答えを与えるのに十分なことを私たちに本当に言っていません
Decide size of share for each child, also determine what to do with any "remainder"
For each child
allocate an array sufficient to hold the required number of value
populate the array
あなたはどのビットに固執していますか?