Sea*_*VDH 3 c linux printf for-loop segmentation-fault
我正在使用POSIX线程,在我的程序结束时,我正在等待加入每个线程.经过一段时间的完美运行后,我的代码在等待线程时开始返回一个奇怪的错误.
pthreads threads[C+P];
for(i = 0; i < (C+P); i++)
{
printf("%d\n", i);
pthread_join(threads[i]);
}
Run Code Online (Sandbox Code Playgroud)
如果我删除了printf语句,或者将其替换为任何其他printf语句,延迟或对i的任何其他操作,我仍然会遇到段错误.
我该如何开始调试呢?