Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // Function Declaration
- /*
- returnType functionName(parameter) {
- }
- */
- double mul(double numOne, double numTwo) {
- double x = numOne * numTwo; // Local variable
- return x;
- }
- double div(double numOne, double numTwo) {
- double x;
- if (numTwo == 0) {
- x = -1;
- } else {
- double x = numOne / numTwo; // Local variable
- }
- return x;
- }
- int numOne, numTwo;
- void Fun() {
- scanf("%d %d", &numOne, &numTwo);
- printf("In Function: \n");
- printf("NumOne = %d, NumTwo = %d\n", numOne, numTwo);
- }
- // void hello() {
- // printf("Hello world\n");
- // }
- int main() {
- scanf("%d %d", &numOne, &numTwo);
- printf("\nIn Main Func: \n");
- printf("NumOne = %d, NumTwo = %d\n", numOne, numTwo);
- }
- // int main() {
- // int arr[5] = {1, 2, 3, 4, 5};
- // int *p;
- // p = &arr[0];
- // printf("%p\n", p);
- // for (int i = 0; i < 5; i++) {
- // printf("%d ", *(p + i));
- // }
- // printf("\n");
- // int var = 10;
- // int var2 = 20;
- // int *p, *q;
- // p = &var;
- // q = &var2;
- // printf("%p %p\n", p, q);
- // }
- /*
- -> Pointer // pointer er kaj holo address niye kaj kora
- -> Function
- -> Function Declaration
- -> With Parameter and without parameter
- -> void
- -> Pass by value
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement