esto no es una función anidada en C ? (la función displayCuentas())
Sé que podría haber definido la función de manera diferente y las variables pasadas y qué no, pero de todos modos funciona bien ya que necesitaba imprimir las cuentas varias veces.
(snipet tomado de una tarea escolar) ...
//function 'main' that executes the program.
int main(void)
{
int customerArray[3][3] = {{1, 1000, 600}, {2, 5000, 2500}, {3, 10000, 2000}}; //multidimensional customer data array.
int x, y; //counters for the multidimensional customer array.
char inquiry; //variable used to store input from user ('y' or 'n' response on whether or not a recession is present).
//function 'displayAccounts' displays the current status of accounts when called.
void displayAccounts(void)
{
puts("\t\tBank Of Despair\n\nCustomer List:\n--------------");
puts("Account # Credit Limit\t Balance\n--------- ------------\t -------");
for(x = 0; x <= 2; x++)
{
for(y = 0; y <= 2; y++)
printf("%9d\t", customerArray[x][y]);
puts("\n");
}
}
displayAccounts(); //prints accounts to console.
printf("Is there currently a recession (y or n)? ");
//...
return 0;
}
parece ser un duplicado de: http://stackoverflow.com/questions/1348095/why-are-nested-functions-not-supported-by- the-c-standard – zoli2k
también http://stackoverflow.com/questions/666586/are-nested-functions-part-of-c-standard y http://stackoverflow.com/questions/2256647/is-it-possible -in-c-or-c-to-create-a-function-inside-another y http://stackoverflow.com/questions/957592/functions-inside-functions-in-c y otras tomadas de http: // stackoverflow.com/search?q=nested+functions+[c] – dmckee
Use Python, es más fácil. –