Function Pointer in C - GeeksforGeeks
文章推薦指數: 80 %
1) Unlike normal pointers, a function pointer points to code, not data. Typically a function pointer stores the start of executable code.
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
▲RelatedArticlesDangling,Void,NullandWildPointersAnUncommonrepresentationofarrayelementsHowtodeclareapointertoafunction?PointervsArrayinCvoidpointerinC/C++NULLpointerinCFunctionPointerinCWhatarenear,farandhugepointers?GenericLinkedListinCLinkedList|Set1(Introduction)LinkedList|Set2(Insertinganode)LinkedList|Set3(Deletinganode)DeleteaLinkedListnodeatagivenpositionWriteafunctiontodeleteaLinkedListFindLengthofaLinkedList(IterativeandRecursive)SearchanelementinaLinkedList(IterativeandRecursive)WriteafunctiontogetNthnodeinaLinkedListArraysinC/C++DynamicMemoryAllocationinCusingmalloc(),calloc(),free()andrealloc()std::sort()inC++STLBitwiseOperatorsinC/C++CoreDump(Segmentationfault)inC/C++WhatisMemoryLeak?Howcanweavoid?ConvertingStringstoNumbersinC/C++MultidimensionalArraysinC/C++LeftShiftandRightShiftOperatorsinC/C++rand()andsrand()inC/C++SubstringinC++DifferentMethodstoReverseaStringinC++CommandlineargumentsinC/C++Dangling,Void,NullandWildPointersAnUncommonrepresentationofarrayelementsHowtodeclareapointertoafunction?PointervsArrayinCvoidpointerinC/C++NULLpointerinCFunctionPointerinCWhatarenear,farandhugepointers?GenericLinkedListinCLinkedList|Set1(Introduction)LinkedList|Set2(Insertinganode)LinkedList|Set3(Deletinganode)DeleteaLinkedListnodeatagivenpositionWriteafunctiontodeleteaLinkedListFindLengthofaLinkedList(IterativeandRecursive)SearchanelementinaLinkedList(IterativeandRecursive)WriteafunctiontogetNthnodeinaLinkedListArraysinC/C++DynamicMemoryAllocationinCusingmalloc(),calloc(),free()andrealloc()std::sort()inC++STLBitwiseOperatorsinC/C++CoreDump(Segmentationfault)inC/C++WhatisMemoryLeak?Howcanweavoid?ConvertingStringstoNumbersinC/C++MultidimensionalArraysinC/C++LeftShiftandRightShiftOperatorsinC/C++rand()andsrand()inC/C++SubstringinC++DifferentMethodstoReverseaStringinC++CommandlineargumentsinC/C++FunctionPointerinCViewDiscussion
ImproveArticle
SaveArticle
LikeArticle
DifficultyLevel:
MediumLastUpdated:
05Sep,2018InC,likenormaldatapointers(int*,char*,etc),wecanhavepointerstofunctions.Followingisasimpleexamplethatshowsdeclarationandfunctioncallusingfunctionpointer.#include
延伸文章資訊
- 1Function pointers - C# 9.0 specification proposals
//This method has a managed calling convention. ... delegate Func1 Func2(Func1 f); // Function po...
- 2[C語言] function pointer介紹. 其實我覺得
其實我想之所以function pointer比較難以被接受的其中一個原因,是因為其語法格式與一般熟知的C語言是有段差距的,所以以下我們就一般的函數宣告以及function pointer ...
- 3Function pointer - Wikipedia
- 4C Language Pointer as Function Argument - Studytonight
- 5(c/c++) Function Pointer函式指標兩三事 ... - 草之程式小記
Function Pointer (中文直譯「函式指標」),即為儲存某一個函式起始memory address的變數,此變數可以提供我們在之後進行呼叫。 乍聽之下,function ...