This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static variable inside a function

 
jason picardo
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I hava a samll problem please help me out.
I tried to declare a static variable inside a funtion,the compiler gave me a error. I want to know why it is not possible to declare a static variable inside a function in java where as
it possible in c++.
Thanks.
E-mail: jason_jp@usa.net
[This message has been edited by jason picardo (edited November 16, 2000).]
 
Mary Anitha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We cannot declare static variables inside a method
coz the scope will be limited to that method
 
asim wagan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understand this way:
non static variables are for classes ,methods.
static variables remember are always for classes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic