Learn C Function by Example 1 : Underscore and Alphanumerics are allowed

Basic Note :

  1. In C Programming Function name should be valid identifier.
  2. Valid Identifier includes following -
- Underscore
- Alphabets
- Digits
  1. C Function Name always starts with either alphabet or underscore.
  2. C Function Name may contain digit as ‘nth’ character where n is not starting character.

Learn by Program : Valid Example

#include<stdio.h>
void printMessage();
int main()
{
   printMessage();
}
void printMessage(){
   printf("Hello World");
}

Learn by Program : Invalid Example

#include<stdio.h>
void printMessage();
int main()
{
   printMessage();
}
void print Message(){
   printf("Hello World");
}

[tabs tab1="Valid Function Names" tab2="Invalid Function Names" ] [tab id=1] [checklist]
  • addNumber()
  • _add()
  • print30()
[/checklist] [/tab] [tab id=2] [checklist]
  • add Number()
  • 30add()
  • $print30()
[/checklist] [/tab] [/tabs]