DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: doubt regarding Extern usage

  1. #1
    Join Date
    Nov 2006
    Posts
    3

    doubt regarding Extern usage

    //////////////////// 1.C ////////////////

    #include<stdio.h>
    #include"2.c"

    void call(); ---------------------->without using the Extern keyword also ,it is working finely.why is it so?How to use Extern without including Header File(Here 2.c)?


    void main()
    {
    printf("\n1.c\n");
    call();
    }

    //////////////////2.C////////////////////

    call()
    {
    printf("In call fumnction");

    }

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    You never need to declare a freestanding function extern, since by default, functions are extern. extern is most used for variables and objects that are declared globally.
    Functions, structs, templates etc. have external linkage by default so there's no need to declare them extern explictly.
    Danny Kalev

  3. #3
    Join Date
    Dec 2003
    Posts
    3,366
    except for extern "C" -
    Te keyword extern is normally avoided along the same idea that goto is normally avoided. As was said, it makes variables global.

Similar Threads

  1. DAO 3.5 vs 3.6 memory usage
    By Methuselah in forum VB Classic
    Replies: 2
    Last Post: 07-13-2005, 10:30 AM
  2. ADo.Net Concurrency doubt
    By sunilbenjamin in forum .NET
    Replies: 1
    Last Post: 06-13-2005, 12:58 PM
  3. Doubt in Remoting - C#
    By vijay in forum .NET
    Replies: 0
    Last Post: 02-26-2003, 07:31 AM
  4. SQL Server 7 SP2 Memory Usage
    By Andy in forum Database
    Replies: 0
    Last Post: 10-18-2001, 11:53 AM
  5. Re: CPU Usage
    By Chris Fitzsimons in forum VB Classic
    Replies: 2
    Last Post: 03-16-2000, 05:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center