A function name in c can have only alphabet,digits and underscore. If we will use any other characters in the function name then we will get a compilation error.
Example:
#include<stdio.h>
int main(){
int min=1,max=100;
int sum;
sum=sum ofdigit(min,max);
printf("sum = %d",sum);
return 0;
}
int sum of digit(int min,int max){
int total;
total=(min+max)* (max-min+1)/2;
return total;
}
Output: Compilation error
Explanation: Function name cannot have blank space characters.
Valid name: world, addition23, sum_of_number etc.
Invalid name: factorial#, avg value, display*number etc.
Invalid name: factorial#, avg value, display*number etc.
Definition of function in c
Name of function includes only alphabets, digit and underscore.
First character of name of any function must be an alphabet or underscore.
Name of function cannot be any keyword of c program.
Name of function cannot be global identifier.
Name of function cannot be exactly same as of name of function in the same scope.
Name of function is case sensitive
Name of function cannot be register Pseudo variable
No comments:
Post a Comment