Thread: Static variable usage

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    You can't do that. If you want the value in b static, make it so within the body of the function.

    Code:
    void func(int b)
    {
        static int c = b;
        printf("%d", c);
    }
    Last edited by kermit; 12-27-2013 at 10:48 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static Variable and Static method
    By codewriter in forum C++ Programming
    Replies: 6
    Last Post: 03-25-2012, 07:49 AM
  2. Doubt on usage of static...
    By sanddune008 in forum C Programming
    Replies: 7
    Last Post: 05-11-2009, 08:09 AM
  3. Static variable usage
    By shwetha_siddu in forum C Programming
    Replies: 1
    Last Post: 04-02-2009, 12:33 AM
  4. Replies: 8
    Last Post: 01-19-2009, 07:42 PM
  5. Replies: 6
    Last Post: 12-13-2007, 08:20 PM