fork download
  1. #include <stdio.h>
  2.  
  3. int foo(int i) {
  4. printf("executing %s(%d)\n", __func__, i); // we called bar(), but function is still named "foo"
  5. return i*i;
  6. }
  7.  
  8. int main(void) {
  9. int (*bar)(int) = foo; // provide an alias to foo
  10. int foo; // shadow the foo identifier
  11. foo = bar(4); // foo is an int, call the function through the alias
  12. printf("4^2 is %d\n", foo); // foo is still an int
  13. }
  14.  
Success #stdin #stdout 0s 5348KB
stdin
Standard input is empty
stdout
executing foo(4)
4^2 is 16