Thread: extern var

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    32

    Lightbulb extern var

    why don't we use all variables as external variables in c?

  2. #2
    Make Fortran great again Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    1,383
    Why would you want to? The extern keyword means the variable is defined in another file.

    Do you really mean to ask why don't we make all variables global?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    34,677
    > why don't we use all variables as external variables in c?
    Create a single global variable called 'i' and use if for ALL your loops.

    Then report back.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 08-16-2010, 11:00 AM
  2. [C#] Intercept SysListView32 item added
    By Devils Child in forum Windows Programming
    Replies: 9
    Last Post: 03-26-2010, 08:29 AM
  3. Need help assignment
    By 6kaine9 in forum C Programming
    Replies: 26
    Last Post: 10-19-2008, 09:51 PM
  4. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  5. server question
    By xddxogm3 in forum Tech Board
    Replies: 24
    Last Post: 01-21-2004, 01:12 AM
Website Security Test