Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Mandy_Nakamoto

  • 2 years ago

what does static array means in c programming????

  • This Question is Closed
  1. UnexpectedEOF
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    In the context of C, the keyword "static" means that the value of a variable/pointer is saved from deletion in certain instances. Static arrays are a kind of static variable, and are set to null when declared (see http://stackoverflow.com/questions/553213/c-static-array). Example of a static var inside a function: By declaring a static variable (let's say it's an int and declared "int mystaticvar") inside a function, I can call the function multiple times and each time the value of mystaticvar would be whatever it was at the end of the previous call. Example: -I call the function myFunc() and inside it the variable mystaticvar is declared to be 0. myFunc then sets the value of mystaticvar to 1. myFunc() returns, and all other non-static vars are eliminated. -I call myFunc again, and now mystaticvar's value is 1 before I do anything with it! Hope this helps!

  2. Mandy_Nakamoto
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thank you..^^

  3. Mandy_Nakamoto
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    but it says static.. i thought it means by constant.. so the value still change???

  4. agdgdgdgwngo
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The true meaning/purpose of the keywords in C or C-like languages greatly differ from their English meaning :-D

  5. benjica
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Static in this case means that the variable retains definition and declaration even when it's scope is released. Calls can still be made to change the value of the variable. It isn't lost when the scope concludes. Constant implies the value never changes.

  6. Mandy_Nakamoto
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @benjica scope???

  7. DerrickDotEl
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    static does not need to be instantiated.

  8. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.