Click here to Skip to main content
15,910,787 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionside by side configration error Pin
VCProgrammer22-Sep-08 23:55
VCProgrammer22-Sep-08 23:55 
AnswerRe: side by side configration error Pin
toxcct23-Sep-08 0:03
toxcct23-Sep-08 0:03 
GeneralRe: side by side configration error Pin
VCProgrammer23-Sep-08 0:07
VCProgrammer23-Sep-08 0:07 
GeneralRe: side by side configration error Pin
Rajesh R Subramanian23-Sep-08 0:08
professionalRajesh R Subramanian23-Sep-08 0:08 
GeneralRe: side by side configration error Pin
VCProgrammer23-Sep-08 0:14
VCProgrammer23-Sep-08 0:14 
GeneralRe: side by side configration error PinPopular
Rajesh R Subramanian23-Sep-08 0:18
professionalRajesh R Subramanian23-Sep-08 0:18 
AnswerRe: side by side configration error Pin
KarstenK23-Sep-08 2:33
mveKarstenK23-Sep-08 2:33 
QuestionVariable scoping and pointers Pin
Christian Flutcher22-Sep-08 23:42
Christian Flutcher22-Sep-08 23:42 
I am progressing with my C++ learning. I am stuck with the following code.
void ChangeData(int** ptr){
	int ab = 1000;  // scope in this method
	*ptr = &ab;
}

int _tmain(int argc, _TCHAR* argv[])
{
	int a = 10;
	int* aPtr = &a;
	ChangeData(&aPtr);
	cout << *aPtr << endl;
	return 0;
}
In the ChangeData method, I am assigning address of a local variable to the supplied parameter. When ChangeData returns to the main, I believe variable ab will get removed from the stack. I was expecing an error when I run the above application, but the above one works!

I am confused how this is happening? If ab is removed from stack, which address the pointer holds and how I am getting correct value?
AnswerRe: Variable scoping and pointers Pin
Russell'22-Sep-08 23:50
Russell'22-Sep-08 23:50 
AnswerRe: Variable scoping and pointers Pin
Cedric Moonen22-Sep-08 23:50
Cedric Moonen22-Sep-08 23:50 
GeneralRe: Variable scoping and pointers Pin
Christian Flutcher22-Sep-08 23:58
Christian Flutcher22-Sep-08 23:58 
AnswerRe: Variable scoping and pointers Pin
Rajesh R Subramanian22-Sep-08 23:55
professionalRajesh R Subramanian22-Sep-08 23:55 
GeneralRe: Variable scoping and pointers Pin
Christian Flutcher23-Sep-08 0:08
Christian Flutcher23-Sep-08 0:08 
AnswerRe: Variable scoping and pointers Pin
Rajesh R Subramanian23-Sep-08 0:58
professionalRajesh R Subramanian23-Sep-08 0:58 
GeneralRe: Variable scoping and pointers Pin
Christian Flutcher23-Sep-08 1:05
Christian Flutcher23-Sep-08 1:05 
GeneralRe: Variable scoping and pointers Pin
Cedric Moonen23-Sep-08 1:26
Cedric Moonen23-Sep-08 1:26 
GeneralRe: Variable scoping and pointers Pin
Rajesh R Subramanian23-Sep-08 1:35
professionalRajesh R Subramanian23-Sep-08 1:35 
QuestionAudio Capturing for RTP - Windows Pin
CrazyDogg22-Sep-08 23:29
CrazyDogg22-Sep-08 23:29 
AnswerRe: Audio Capturing for RTP - Windows Pin
Mark Salsbery23-Sep-08 10:24
Mark Salsbery23-Sep-08 10:24 
GeneralRe: Audio Capturing for RTP - Windows [modified] Pin
CrazyDogg23-Sep-08 21:26
CrazyDogg23-Sep-08 21:26 
GeneralRe: Audio Capturing for RTP - Windows Pin
Mark Salsbery24-Sep-08 5:44
Mark Salsbery24-Sep-08 5:44 
AnswerRe: Audio Capturing for RTP - Windows Pin
Mark Salsbery23-Sep-08 10:27
Mark Salsbery23-Sep-08 10:27 
QuestionGetting number of channels from a WMV Pin
Ben.Robinson.2322-Sep-08 23:19
Ben.Robinson.2322-Sep-08 23:19 
AnswerRe: Getting number of channels from a WMV Pin
Mark Salsbery23-Sep-08 10:33
Mark Salsbery23-Sep-08 10:33 
QuestionScrollbars are not working in VISTA Pin
hari_honey22-Sep-08 23:08
hari_honey22-Sep-08 23:08 

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.