fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Rooster {
  5. int id = 0;
  6. };
  7.  
  8. static const Rooster petushok[3];
  9.  
  10. void asshole(const Rooster* roosters) {
  11. Rooster* r = const_cast<Rooster*>(roosters);
  12. for (int i = 0; i < 3; i++) {
  13. r[i].id = i + 1;
  14. }
  15. }
  16.  
  17.  
  18. int main() {
  19. asshole(petushok);
  20. for (int i = 0; i < 3; i++) {
  21. printf("%d\n", petushok[i].id);
  22. }
  23. return 0;
  24. }
Runtime error #stdin #stdout 0s 4540KB
stdin
Standard input is empty
stdout
Standard output is empty