The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
NIM Questions tb0ne AIX 5 08-16-2007 07:23 AM
Few questions gina Shell Programming and Scripting 2 05-28-2007 05:47 AM
A few questions... halluc1nati0n UNIX for Dummies Questions & Answers 2 03-28-2007 10:29 AM
3 questions in 1 alikun UNIX for Dummies Questions & Answers 2 03-27-2007 02:59 AM
ftp questions lewisoco UNIX for Advanced & Expert Users 5 10-27-2005 05:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-17-2003
Esaia Esaia is offline
Registered User
  
 

Join Date: Jul 2002
Location: Sweden
Posts: 51
Question C questions

What does "extern" do?
ex. extern int x;

and another question, what about using static in functions? like: static void foo(), why?
  #2 (permalink)  
Old 01-17-2003
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
You really need to read a book on C programming, but I will try a brief answer.

If I do "extern int errno" I am telling the compiler that errno is an integer. But it is really defined in some other module. So the compiler will not create a variable called errno, it will just reference it. Then when I run "ld" I better be including a module that defines errno without the extern.

Putting "static" on a function will make the function invisible to the outside world. It can only be called by other functions in the same source file.
  #3 (permalink)  
Old 01-17-2003
Esaia Esaia is offline
Registered User
  
 

Join Date: Jul 2002
Location: Sweden
Posts: 51
c

aha thanks allot!

I do have a C book but I did not have it with me here. I was confused whilst reading source file.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0