Callbacks in C - GeeksforGeeks
文章推薦指數: 80 %
A callback is any executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at a ...
Skiptocontent
CoursesForWorkingProfessionalsLIVEDSALiveClassesSystemDesignJavaBackendDevelopmentFullStackLIVEExploreMoreSelf-PacedDSA-SelfPacedSDETheoryMust-DoCodingQuestionsExploreMoreForStudentsLIVECompetitiveProgrammingDataStructureswithC++DataScienceExploreMoreSelf-PacedDSA-SelfPacedCIPJAVA/Python/C++ExploreMoreSchoolCoursesSchoolGuidePythonProgrammingLearnToMakeAppsExploremoreAllCoursesTutorialsAlgorithmsAnalysisofAlgorithmsAsymptoticAnalysisWorst,AverageandBestCasesAsymptoticNotationsLittleoandlittleomeganotationsLowerandUpperBoundTheoryAnalysisofLoopsSolvingRecurrencesAmortizedAnalysisWhatdoes'SpaceComplexity'mean?Pseudo-polynomialAlgorithmsPolynomialTimeApproximationSchemeATimeComplexityQuestionSearchingAlgorithmsSortingAlgorithmsGraphAlgorithmsPatternSearchingGeometricAlgorithmsMathematicalBitwiseAlgorithmsRandomizedAlgorithmsGreedyAlgorithmsDynamicProgrammingDivideandConquerBacktrackingBranchandBoundAllAlgorithmsDataStructuresArraysLinkedListStackQueueBinaryTreeBinarySearchTreeHeapHashingGraphAdvancedDataStructureMatrixStringsAllDataStructuresInterviewCornerCompanyPreparationTopTopicsPracticeCompanyQuestionsInterviewExperiencesExperiencedInterviewsInternshipInterviewsCompetititveProgrammingDesignPatternsSystemDesignTutorialMultipleChoiceQuizzesLanguagesCC++JavaPythonC#JavaScriptjQuerySQLPHPScalaPerlGoLanguageHTMLCSSKotlinML&DataScienceMachineLearningDataScienceCSSubjectsMathematicsOperatingSystemDBMSComputerNetworksComputerOrganizationandArchitectureTheoryofComputationCompilerDesignDigitalLogicSoftwareEngineeringGATEGATEComputerScienceNotesLastMinuteNotesGATECSSolvedPapersGATECSOriginalPapersandOfficialKeysGATE2021DatesGATECS2021SyllabusImportantTopicsforGATECSWebTechnologiesHTMLCSSJavaScriptAngularJSReactJSNodeJSBootstrapjQueryPHPSoftwareDesignsSoftwareDesignPatternsSystemDesignTutorialSchoolLearningSchoolProgrammingMathematicsNumberSystemAlgebraTrigonometryStatisticsProbabilityGeometryMensurationCalculusMathsNotes(Class8-12)Class8NotesClass9NotesClass10NotesClass11NotesClass12NotesNCERTSolutionsClass8MathsSolutionClass9MathsSolutionClass10MathsSolutionClass11MathsSolutionClass12MathsSolutionRDSharmaSolutionsClass8MathsSolutionClass9MathsSolutionClass10MathsSolutionClass11MathsSolutionClass12MathsSolutionPhysicsNotes(Class8-11)Class8NotesClass9NotesClass10NotesClass11NotesChemistryNotesClass8NotesClass9NotesClass10NotesCSExams/PSUsISROISROCSOriginalPapersandOfficialKeysISROCSSolvedPapersISROCSSyllabusforScientist/EngineerExamUGCNETUGCNETCSNotesPaperIIUGCNETCSNotesPaperIIIUGCNETCSSolvedPapersStudentCampusAmbassadorProgramSchoolAmbassadorProgramProjectGeekoftheMonthCampusGeekoftheMonthPlacementCourseCompetititveProgrammingTestimonialsStudentChapterGeekontheTopInternshipCareersJobsApplyforJobsPostaJobHirewithUsKnowaboutJobathonJobathonPracticeAllDSAProblemsProblemoftheDayInterviewSeries:WeeklyContestsBi-WizardCoding:SchoolContestsContestsandEventsPracticeSDESheetCuratedDSAListsTop50ArrayProblemsTop50StringProblemsTop50TreeProblemsTop50GraphProblemsTop50DPProblems
ComewritearticlesforusandgetfeaturedLearnandcodewiththebestindustryexpertsGetaccesstoad-freecontent,doubtassistanceandmore!ComeandfindyourdreamjobwithusGeeksDigestQuizzesGeeksCampusGblogArticlesIDECampusMantriHomeSavedVideosCoursesGBlogPuzzlesWhat'sNew?
ChangeLanguage
DataStructuresAlgorithmsInterviewPreparationTopic-wisePracticeC++JavaPythonCompetitiveProgrammingMachineLearningHTMLSDESheetPuzzlesGFGSchoolProjects
RelatedArticles
▲RelatedArticlesCallbacksinCNestedfunctionsinCParameterPassingTechniquesinC/C++C++ProgrammingandSTLFactssqrt,sqrtlandsqrtfinC++PowerFunctioninC/C++tolower()functioninCMeasureexecutiontimewithhighprecisioninC/C++MeasureexecutiontimeofafunctioninC++HowtomeasuretimetakenbyafunctioninC?time()functioninCProgramtoreverseastring(IterativeandRecursive)PrintreverseofastringusingrecursionWriteaprogramtoprintallpermutationsofagivenstringPrintalldistinctpermutationsofagivenstringwithduplicatesPermutationsofagivenstringusingSTLAllpermutationsofanarrayusingSTLinC++std::next_permutationandprev_permutationinC++LexicographicallyNextPermutationinC++HowtoprintsizeofarrayparameterinC++?HowtosplitastringinC/C++,PythonandJava?boost::splitinC++libraryTokenizingastringinC++getline()FunctionandCharacterArrayinC++getline(string)inC++ArraysinC/C++DynamicMemoryAllocationinCusingmalloc(),calloc(),free()andrealloc()std::sort()inC++STLBitwiseOperatorsinC/C++CoreDump(Segmentationfault)inC/C++CallbacksinCNestedfunctionsinCParameterPassingTechniquesinC/C++C++ProgrammingandSTLFactssqrt,sqrtlandsqrtfinC++PowerFunctioninC/C++tolower()functioninCMeasureexecutiontimewithhighprecisioninC/C++MeasureexecutiontimeofafunctioninC++HowtomeasuretimetakenbyafunctioninC?time()functioninCProgramtoreverseastring(IterativeandRecursive)PrintreverseofastringusingrecursionWriteaprogramtoprintallpermutationsofagivenstringPrintalldistinctpermutationsofagivenstringwithduplicatesPermutationsofagivenstringusingSTLAllpermutationsofanarrayusingSTLinC++std::next_permutationandprev_permutationinC++LexicographicallyNextPermutationinC++HowtoprintsizeofarrayparameterinC++?HowtosplitastringinC/C++,PythonandJava?boost::splitinC++libraryTokenizingastringinC++getline()FunctionandCharacterArrayinC++getline(string)inC++ArraysinC/C++DynamicMemoryAllocationinCusingmalloc(),calloc(),free()andrealloc()std::sort()inC++STLBitwiseOperatorsinC/C++CoreDump(Segmentationfault)inC/C++CallbacksinCViewDiscussion
ImproveArticle
SaveArticle
LikeArticle
DifficultyLevel:
MediumLastUpdated:
05Mar,2019Acallbackisanyexecutablecodethatispassedasanargumenttoothercode,whichisexpectedtocallback(execute)theargumentatagiventime[Source:Wiki].Insimplelanguage,Ifareferenceofafunctionispassedtoanotherfunctionasanargumenttocallit,thenitwillbecalledasaCallbackfunction.InC,acallbackfunctionisafunctionthatiscalledthroughafunctionpointer.BelowisasimpleexampleinCtoillustratetheabovedefinitiontomakeitmoreclear://AsimpleCprogramtodemonstratecallback#include
延伸文章資訊
- 1Callback Function in C - Linux Hint
- 2JavaScript Callback Functions – What are Callbacks in JS and How to Use ...
- 3Callback function - MDN Web Docs Glossary: Definitions of Web-related ...
- 4何謂callback function? - iT 邦幫忙
然後它會在適當的時間呼叫此function,則此function就是所謂的callback function。因為這個function是被『callback』了。 舉一個C的例子來說:
- 5Callbacks in C - Tutorialspoint