We need to declare function prototype for user defined functions in C. Function prototype provides the following information about the function to the compiler.
1. Return type
2. Function name
3. Argument list
Example:
int add(int, int);
<return type> <function_name> (<arg1>, <arg2>,..);
Example C program to illustrate function prototype:
#include <stdio.h> void print_info(char []); /* * void print_info(char []) is the function * prototype with return type "void", func * name "print_info" and argument "a char * array" */ int main() { char str[100]; printf("Enter your input string:"); fgets(str, 100, stdin); print_info(str); return 0; } void print_info(char array[]) { printf("%s", array); }
Output:
jp@jp-VirtualBox:~/cpgms/functions$ ./a.out
Enter your input string: Helloworld
Helloworld
Enter your input string: Helloworld
Helloworld
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