-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pointer function arguments #89
Conversation
Thanks for the PR :) It will be reviewed in due course. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I made some suggestions :)
|
||
e.g: | ||
float (*add)(); this is a valid declaration for the function pointer | ||
float *add(); this is an illegal declaration for the funciton pointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float *add(); this is an illegal declaration for the funciton pointer | |
float *add(); this is an illegal declaration for the function pointer |
4. We assign Function2 to FunctionPointer: FunctionPointer = Function2 | ||
5. We then call function F1 with FunctionPointer as a parameter. | ||
|
||
We shall see an illustration of this in the example below. | ||
------------------------------------------------------------------------------------ | ||
*/ | ||
|
||
// Code here explaining concept with comments to guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Code here explaining concept with comments to guide |
Challenge: | ||
1. Write a function that prints "I love pointers!" | ||
2. Declare a corresponding function pointer and assign the previous function to it. | ||
3. Write a second function with the correspoing function pointer type as parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Write a second function with the correspoing function pointer type as parameter. | |
3. Write a second function with the corresponding function pointer type as parameter. |
Adding hacktoberfest-accepted label. Will review and merge later on. |
Please fill in this pull request template before submitting
1. This pull request resolves #26
2. Description
This tutorial explains function pointers as arguments in C. It first describes what a function pointer is and then shows how to pass a function pointer as a parameter to a function.
3. Fill in checklist by marking [x]