Jump to content

global variables...how to make them

- - - - -

  • Please log in to reply
1 reply to this topic

#1
alirezan

alirezan

    Learning Programmer

  • Members
  • PipPipPip
  • 62 posts
Hi

I have this code:

Quote

WinTCPClient * tcpConn_p = WinTCPClient::CreateClient();

if ( !tcpConn_p )
{
printf(" Problems with WinTCPClient... closing\n");
return 0;
}


WinTCPClient & tcpConn = *tcpConn_p;


if ( !tcpConn.OpenConnection(serverAddr,serverPort) )
{
printf(" Problems connecting to TRACC Unit... closing\n");
delete tcpConn_p;
return 0;
}
I want to make "tcpConn_p" and "tcpConn" global so I can access them from other functions after they are initialized in the main function.
Can someone help me do it please?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Declare them in a global space.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users