C/Static

Advertisement


Question
Dear sir
Could you plese tell me what is the static function in C programming? where it is used? & what is their pecularity(if any) ?  

Answer
static is a qualifier in C.
It tells that whatever is declared with static will have a local scope and will live till the program exits.
For any function in C program, its scope is global.
So, if your program spans more than one file, then you can access functions in different files.
If you put static infront of a function, it becomes local to a file. That means another function residing in another file (ofcourse it also belongs to the same program) cannot access this funtion.

Hope it is clear now.

-ssnkumar

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.