Click here to Skip to main content
15,890,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIP TO COUNTRY Pin
Daniel Kanev2-Jan-07 8:32
Daniel Kanev2-Jan-07 8:32 
AnswerRe: IP TO COUNTRY Pin
Graham Bradshaw2-Jan-07 8:58
Graham Bradshaw2-Jan-07 8:58 
AnswerRe: IP TO COUNTRY Pin
ThatsAlok2-Jan-07 18:42
ThatsAlok2-Jan-07 18:42 
QuestionHow to -- get a pointer to INetConnectionCommonUi in netcon.h Pin
werpa2-Jan-07 6:14
werpa2-Jan-07 6:14 
Questionwhat is the meaning of this expression int *(*table())[30]; Pin
Ayman Mashal2-Jan-07 4:31
Ayman Mashal2-Jan-07 4:31 
AnswerRe: what is the meaning of this expression int *(*table())[30]; Pin
David Crow2-Jan-07 8:16
David Crow2-Jan-07 8:16 
AnswerRe: what is the meaning of this expression int *(*table())[30]; Pin
werpa2-Jan-07 8:50
werpa2-Jan-07 8:50 
GeneralRe: what is the meaning of this expression int *(*table())[30]; Pin
John R. Shaw2-Jan-07 10:26
John R. Shaw2-Jan-07 10:26 
Very good 

The oops function needs a modification though: All the internal stack variable need to be changed to static or the address of the returned array and all the pointer it contains will be invalid after leaving the function.

int *(*oops())[3]
{
	static int m = 0;
	static int n = 1;
	static int p = 2;
	static int *a[3];
	a[0] = &m;
	a[1] = &n;
	a[2] = &p;
	return &a;
}

int main(/*int argc, char* argv[]*/)
{
	int* (*t)[3] = oops();
	for( int i=0; i<3; ++i )
		std::cout << *(*t)[i] << std::endl;
	return 0;
}



INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

AnswerRe: what is the meaning of this expression int *(*table())[30]; Pin
Michael Dunn2-Jan-07 15:04
sitebuilderMichael Dunn2-Jan-07 15:04 
GeneralRe: what is the meaning of this expression int *(*table())[30]; Pin
Mark Salsbery2-Jan-07 15:17
Mark Salsbery2-Jan-07 15:17 
AnswerRe: what is the meaning of this expression int *(*table())[30]; Pin
Ayman Mashal3-Jan-07 20:12
Ayman Mashal3-Jan-07 20:12 
GeneralRe: what is the meaning of this expression int *(*table())[30]; Pin
werpa5-Jan-07 8:46
werpa5-Jan-07 8:46 
Questionchar and int mixed array repeat output ! Pin
davvid2-Jan-07 4:10
davvid2-Jan-07 4:10 
AnswerRe: char and int mixed array repeat output ! Pin
CPallini2-Jan-07 4:28
mveCPallini2-Jan-07 4:28 
AnswerRe: char and int mixed array repeat output ! Pin
John R. Shaw2-Jan-07 11:14
John R. Shaw2-Jan-07 11:14 
QuestionDetecting GUI events Pin
narada1502-Jan-07 3:08
narada1502-Jan-07 3:08 
AnswerRe: Detecting GUI events Pin
CPallini2-Jan-07 3:24
mveCPallini2-Jan-07 3:24 
GeneralRe: Detecting GUI events Pin
narada1503-Jan-07 8:48
narada1503-Jan-07 8:48 
QuestionMFC Message map routing question Pin
Arris742-Jan-07 2:42
Arris742-Jan-07 2:42 
AnswerRe: MFC Message map routing question Pin
S Douglas2-Jan-07 23:24
professionalS Douglas2-Jan-07 23:24 
GeneralRe: MFC Message map routing question Pin
Arris743-Jan-07 7:32
Arris743-Jan-07 7:32 
QuestionConvert project VC++6.0 to VC++.Net Pin
Atul232-Jan-07 2:20
Atul232-Jan-07 2:20 
AnswerRe: Convert project VC++6.0 to VC++.Net Pin
Cristian Amarie2-Jan-07 6:41
Cristian Amarie2-Jan-07 6:41 
AnswerRe: Convert project VC++6.0 to VC++.Net [modified] Pin
S Douglas2-Jan-07 23:32
professionalS Douglas2-Jan-07 23:32 
QuestionHow to Invoke Resource-Only DLL Dialogs Pin
Pradeep.Reddy2-Jan-07 1:29
Pradeep.Reddy2-Jan-07 1:29 

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.