सी में एक नेस्टेड समारोह यह नहीं है ? (फ़ंक्शन डिस्प्ले अकाउंट्स())
मुझे पता है कि मैं फ़ंक्शन को अलग-अलग परिभाषित कर सकता हूं और चर पारित कर सकता हूं और क्या कोई भी अच्छी तरह से काम नहीं करता क्योंकि मुझे कई बार खातों को मुद्रित करने की आवश्यकता होती है।
(snipet एक स्कूल असाइनमेंट से लिया गया) ...
//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;
}
का डुप्लिकेट लगता है: http://stackoverflow.com/questions/1348095/why-are-nested-functions-not-supported-by- सी-सी-मानक – zoli2k
भी http://stackoverflow.com/questions/666586/are-nested-functions-part-of-c- मानक और http://stackoverflow.com/questions/2256647/is-it- संभावित -in-c-or-c-to-create-a-function-inside-other और http://stackoverflow.com/questions/957592/functions-inside-functions-in-c और अन्य http: // से लिया गया stackoverflow.com/search?q=nested+functions+[c] – dmckee
पायथन का उपयोग करें, यह आसान है। –