Important points about C Language Function

Key Points

We know that Function is very Important part of C Language. With the help of Function Programs are easy to write and understand. So there are some Key points to remember when deal with C Language Function: 
  • A Function gets called when the Function name is followed by a semicolon(;).
Example:

int main()
{
india();                 /* Function calling */
}
  •  A Function can call itself. Such a process is called "recursion". Discuss later.

    • A Function can be called from another Function, but a Function cannot be defined in another Function.
    Example:

    int main()
    {
    printf(" Hello");
    void india()                                /* Function definition */
    {
    printf(" I am in India");
    }

    The above Program code would be wrong because india() is being defined inside another Function main().


    • A Function can be called any number of times.
    Example:

    #include<stdio.h>
    void india();                          /* Function Declaration */
    int main()
    {
    india();                                 /* Function Calling */
    india();                                 /* Function Calling */
    return(0);
    }
    void india()                           /* Function Definition */
    {
    printf(" Hello\n");
    }

    • The order in which the Functions are defined in a Program and the order in which they get called need not necessarily be same.
    Example:

    #include<stdio.h>
    void India();                                      /* Function Declaration */
    void England();                                  /* Function Declaration */
    int main()
    {
    India();                                             /* Function Calling */
    England();                                         /* Function Calling */
    return(0);
    }
    void England()                                   /* Function Definition */
    {
    printf(" Olympic games");   
    }
    void India()                                        /* Function Definition */
    {
    printf(" Beautiful city of corruption");
    }

    India() is getting called before England(), still India() has been defined after England().

    • Any Function can be called from any other Function.
    Example:

    #include<stdio.h>
    void India();                         /* Function Declaration */
    int main()
    {
    India();                                /* Function Calling */
    return(0);
    }
    void India()                          /* Function Definition */
    {
    printf(" Nasa Mars mission successufull");
    main();                               
    }

    • A Function is defined when Function name is followed by a pair of braces in which one or more statements may be present.
    Example:

    void India()                      /* Function Definition */
    {
    stmt 1;
    stmt 2;
    }

                                                                     That's All 

    0 Response to "Important points about C Language Function"

    Post a Comment

    Popular Posts

    Label

    1 Sidebar 2 Columns 3 Columns Footer 3rdball 4 Columns Footer Alex Alvaro Antsasia Arlinadesign Averie Barry BASIC CONCEPTS Basil Bayna Fast BeautyPress BeautyTemplates Beckel Best Best - Clean Beyonce Pro BioMag BlackMag Blanter Nova Blogger Card Bloggertheme9 Blogish Bpress Brakt C LANGUAGE C PROGRAMS C++ LANGUAGE C++ PROGRAMS Carella Cellar Charlotte Chooko Lite Clara Clean Combo One Cooperate Crusade Darry Dorman Dreamway Dunia Blanter eCars EduAcademy EducationPress Elise Elvan Eva Everyday FabNews Fashion Fashion Blogger Template Fashion Gossip FastCars Fedo FlashNews Fredy Portfolio Gaming Globus GoodTime Goomsite HTML LANGUAGE iGaming Indicate Innove Insomnia InspiredNews iSoft Jasmine Kalem Landscaping Lashira Lavelle Lily Fashion Limax Linea Lionex Luminescence Lite Lumix Luxury Magazine MagazinePro MAJOR DIFFERENCES MarketingBlog Martin MaxiMag Medica Mega Melissa Mercury MeshMag Minimag Minimalist MiniNews MovieKhor msdesignbd MusicLand Neko NetZine New Spread News16 Newsflash NewsForce NewsIdea Newspaper News NewsPro Nubie Fast Odd Themes Optima PaperMag PaperMag blog Parhlo Perfection Personal Personal Blog Photosout PixelZ Power Blog Premium Themes ProfileMag Purez Rano ReadNews Real estate Remito Grid Responsive Revo Robusta Rotario Saara SeoBoost Settle Shouters Simple Catch SimpleClean Sketchly SNews SolidMag Someo Sophie Sora Sora Bank Sora Home Sora News Responsive Sora One Sora Ribbon Spido Sticko Stucco Sure Mag Swift Tech Tech Pro Techia Techmax TechSpot TemplateClue Templateism Templatesilk Templatesyard Templatezy The Freelancer TheBlogger TheFocus Themeforest Themexpose TIPS AND TRICKS Topside TravelMag Trendy Trendy Travel Tumblr Under Construction Uong Jowo Veethemes Vertox VideoPlay Vigo Waverly way2themes WebBiz Wedding X-Mag Zealer ZetaMag