Created
January 1, 2015 12:43
-
-
Save clarkzjw/f7400be50c9d9ad68526 to your computer and use it in GitHub Desktop.
Nested function is supported as an extension in gcc, but not g++.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
double foo(double a, double b) | |
{ | |
double square(double a) { return a * a; } | |
return square(a) + square(b); | |
} | |
int main(int argc, char **argv) | |
{ | |
int a = 2, b = 3; | |
printf("%lf\n", foo(a, b)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment