About 602,000 results
Open links in new tab
  1. What is a "static" function in C? - Stack Overflow

    The question was about plain c functions, not c++ static methods, as clarified in comments. I understand what a static variable is, but what is a static function? And why is it that if I declare a

  2. syntax - What does "static" mean in C? - Stack Overflow

    Feb 21, 2009 · In C++, however, static is also used to define class attributes (shared between all objects of the same class) and methods. In C there are no classes, so this feature is irrelevant. …

  3. Reasons to use Static functions and variables in C

    Apr 1, 2014 · 34 I wonder about the use of the static keyword as scope limiting for variables in a file, in C. The standard way to build a C program as I see it is to: have a bunch of c files …

  4. Why declare a variable or function static in C? - Stack Overflow

    Nov 3, 2009 · The keyword static has several uses; Outside of a function it simply limits the visibility of a function or variable to the compilation unit (.c file) the function or variable occurs in.

  5. static function in C - Stack Overflow

    Mar 15, 2011 · The static keyword in C is used in a compiled file (.c as opposed to .h) so that the function exists only in that file. Normally, when you create a function, the compiler generates …

  6. c - What is the advantage of a static function? - Stack Overflow

    Nov 15, 2023 · The declaration below: static int *foo(); declares foo as a static function returning a pointer to an int. What's the purpose of declaring a function as static ?

  7. Why and when to use static structures in C programming?

    The static keyword in C has several effects, depending on the context it's applied to. when applied to a variable declared inside a function, the value of that variable will be preserved between …

  8. Static variable inside of a function in C - Stack Overflow

    A static variable (whether inside a function or not) is initialized exactly once, before any function in that translation unit executes. After that, it retains its value until modified.

  9. The static keyword and its various uses in C++ - Stack Overflow

    Mar 6, 2013 · A static member function differs from a regular member function in that it can be called without an instance of a class, and since it has no instance, it cannot access non-static …

  10. What is the difference between static and extern in C?

    Sep 10, 2010 · The static storage class is used to declare an identifier that is a local variable either to a function or a file and that exists and retains its value after control passes from …