fork download
  1. #include <cstdio>
  2. #include <iostream>
  3. #pragma GCC diagnostic warning "-fpermissive"
  4. int f(){return 75;};
  5.  
  6. typedef unsigned char UC;
  7.  
  8. int main(){
  9. void* x=&f;
  10. UC* c = (UC*)x;
  11. int n=0;
  12. UC w[100];
  13. while(*(c-1)!=UC(195)) {
  14. printf("%x ", *c);
  15. fflush(stdout);
  16. w[n]=*c;
  17. ++c;
  18. ++n;
  19. };
  20. std::cout<<std::hex<<std::endl;
  21. for(int i=0;i<n;i++)std::cout<<int(w[i])<<' ';
  22. int(*a)() = (int(*)())(reinterpret_cast<void*>(w));
  23. std::cout<<std::endl;
  24. for(int i=0;i<n;i++)std::cout<<int(*((UC*)(a+i)))<<' ';
  25. //std::cout<<std::endl<<a();
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
b8 4b 0 0 0 c3 
b8 4b 0 0 0 c3 
b8 4b 0 0 0 c3