C Language supports two types of functions. They are
1. Pre-defined functions or Library functions
2. User defined functions
Difference between library function and user defined functions:
Pre-defined Functions:
Pre-defined functions are built in functions. Users can only use them, but they cannot modify or understand the internal working logic of those functions(until and unless they have source code access).
Example: printf(), scanf(), sqrt(), ceil(), floor() etc.
User defined functions:
Functions that are defined by the users based on their requirements to do a specific tasks are called user defined functions. User can modify these function according to their needs.
Example C program using library functions and user defined functions
#include <stdio.h> int add(int, int); /* * printf(), scanf() - Library functions * add() - user defined function */ int main() { int a, b, sum; printf("Enter your 1st input:"); scanf("%d", &a); printf("Enter your 2nd input:"); scanf("%d", &b); sum = add(a,b); printf("Sum of 2 numbers:%d\n", sum); return 0; } int add(int a, int b){ int ret; ret = a + b; return (ret); }
Output:
jp@jp-VirtualBox:~/cpgms/functions$ ./a.out
Enter your 1st input:30
Enter your 2nd input:50
Sum of 2 numbers:80
Enter your 1st input:30
Enter your 2nd input:50
Sum of 2 numbers:80
Dell Laptop Service center are giving repair service at the door. We should high quality Dell out of warranty Laptop Repair, removal of virus, screen removal, wireless network set up, battery removal, motherboard replacement to several other are offered at budget friendly price and it’s Negotiable. We can fix them all in time by our well experience and certified technicians. If you want to repair your laptop in front of your eyesight, than you may call us: 7217871051
ReplyDelete