Click here to Skip to main content
15,902,893 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: scope in functions Pin
kakan25-Oct-06 1:53
professionalkakan25-Oct-06 1:53 
GeneralRe: scope in functions Pin
benjymous25-Oct-06 3:29
benjymous25-Oct-06 3:29 
GeneralRe: scope in functions [modified] Pin
toxcct25-Oct-06 1:41
toxcct25-Oct-06 1:41 
GeneralRe: scope in functions [modified] Pin
kakan25-Oct-06 1:53
professionalkakan25-Oct-06 1:53 
GeneralRe: scope in functions Pin
toxcct25-Oct-06 2:25
toxcct25-Oct-06 2:25 
GeneralRe: scope in functions Pin
kakan25-Oct-06 3:26
professionalkakan25-Oct-06 3:26 
GeneralRe: scope in functions Pin
toxcct25-Oct-06 3:31
toxcct25-Oct-06 3:31 
GeneralRe: scope in functions Pin
kakan25-Oct-06 3:46
professionalkakan25-Oct-06 3:46 
Funny, in my VC6, this code:
<br />
int* create( )<br />
{<br />
    static int p = 0;<br />
    p++;    <br />
    return &p;<br />
}<br />
<br />
main()<br />
{<br />
    ::printf("%d %d", *(create()), *(create()));<br />
}<br />


Produces the result:
2 1

If I set a breakpoint at "return &p", p contains 1 for the first call, and 2 for the second call.



Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

GeneralRe: scope in functions Pin
toxcct25-Oct-06 3:51
toxcct25-Oct-06 3:51 
GeneralRe: scope in functions Pin
kakan25-Oct-06 4:01
professionalkakan25-Oct-06 4:01 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 4:07
minkowski25-Oct-06 4:07 
GeneralRe: scope in functions Pin
kakan25-Oct-06 4:10
professionalkakan25-Oct-06 4:10 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 4:21
minkowski25-Oct-06 4:21 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 4:29
minkowski25-Oct-06 4:29 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 4:40
minkowski25-Oct-06 4:40 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 4:49
minkowski25-Oct-06 4:49 
GeneralRe: scope in functions Pin
kakan25-Oct-06 19:53
professionalkakan25-Oct-06 19:53 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 23:02
minkowski25-Oct-06 23:02 
GeneralRe: scope in functions Pin
kakan25-Oct-06 23:47
professionalkakan25-Oct-06 23:47 
GeneralRe: scope in functions Pin
minkowski25-Oct-06 23:14
minkowski25-Oct-06 23:14 
GeneralRe: scope in functions Pin
Nemanja Trifunovic25-Oct-06 2:29
Nemanja Trifunovic25-Oct-06 2:29 
AnswerRe: scope in functions Pin
cmk25-Oct-06 7:31
cmk25-Oct-06 7:31 
Questiono Pin
zizzzz25-Oct-06 0:27
zizzzz25-Oct-06 0:27 
AnswerRe: o Pin
_AnsHUMAN_ 25-Oct-06 0:35
_AnsHUMAN_ 25-Oct-06 0:35 
AnswerRe: o Pin
toxcct25-Oct-06 0:39
toxcct25-Oct-06 0:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.