Код: Выделить всё
#include
#include
#include
void print_id(int id){
printf("Hello from thread %d\n", id);
}
int main() {
int n=5;
std::list threads={};
for(int i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/60093210/c-threads-inside-a-for-loop-print-wrong-values[/url]
Мобильная версия