fork download
  1. #include <iostream>
  2.  
  3. void mistakeFunction (char f[])
  4. {
  5. std::cout<<sizeof(f)<<std::endl; // return the sizeof(char *)
  6. }
  7.  
  8. int main()
  9. {
  10. char *f = "hello ";
  11. std::cout<<sizeof(f)<<std::endl;
  12.  
  13. char g[100];
  14. std::cout<<sizeof(g)<<std::endl;
  15.  
  16. mistakeFunction(g);
  17. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
4
100
4