Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to resolve Run time Error ? Pin
prasad_som20-Oct-06 0:23
prasad_som20-Oct-06 0:23 
QuestionLive Redirection Pin
rupert_durans19-Oct-06 23:49
rupert_durans19-Oct-06 23:49 
QuestionHow to change Project settings by using MSDEV Automation. Pin
Jijo.Raj19-Oct-06 23:31
Jijo.Raj19-Oct-06 23:31 
QuestionWhen to declare variables in C/C++ ? Pin
Mr.Brainley19-Oct-06 23:26
Mr.Brainley19-Oct-06 23:26 
AnswerRe: When to declare variables in C/C++ ? Pin
Cedric Moonen19-Oct-06 23:31
Cedric Moonen19-Oct-06 23:31 
AnswerRe: When to declare variables in C/C++ ? Pin
prasad_som19-Oct-06 23:40
prasad_som19-Oct-06 23:40 
AnswerRe: When to declare variables in C/C++ ? Pin
Jonathan [Darka]19-Oct-06 23:43
professionalJonathan [Darka]19-Oct-06 23:43 
AnswerRe: When to declare variables in C/C++ ? Pin
Christian Graus20-Oct-06 0:59
protectorChristian Graus20-Oct-06 0:59 
I guess I need to answer.

As has been said, in C, you have to do it at the top.

In C++, you don't, but some do, just because they learned from someone who does it that way, because they are used to it from C. Declaring the variable close to where you use it makes code more readable and less prone to bugs.


Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog

GeneralRe: When to declare variables in C/C++ ? Pin
benjymous20-Oct-06 1:23
benjymous20-Oct-06 1:23 
AnswerRe: When to declare variables in C/C++ ? Pin
David Crow20-Oct-06 3:18
David Crow20-Oct-06 3:18 
QuestionProblem with IHTMLInputElement Pin
georgekjolly19-Oct-06 23:05
georgekjolly19-Oct-06 23:05 
AnswerRe: Problem with IHTMLInputElement Pin
prasad_som19-Oct-06 23:18
prasad_som19-Oct-06 23:18 
AnswerRe: Problem with IHTMLInputElement Pin
Hamid_RT20-Oct-06 0:06
Hamid_RT20-Oct-06 0:06 
QuestionOLEDATA.MSO Format Pin
Reuven Nisser19-Oct-06 22:56
Reuven Nisser19-Oct-06 22:56 
QuestionPush-like checkboxes in WinXP Pin
Kiomuto19-Oct-06 22:47
Kiomuto19-Oct-06 22:47 
AnswerRe: Push-like checkboxes in WinXP Pin
Hamid_RT20-Oct-06 7:12
Hamid_RT20-Oct-06 7:12 
GeneralRe: Push-like checkboxes in WinXP Pin
Kiomuto21-Oct-06 5:51
Kiomuto21-Oct-06 5:51 
Questionreturning const member data Pin
minkowski19-Oct-06 22:41
minkowski19-Oct-06 22:41 
AnswerRe: returning const member data Pin
Cedric Moonen19-Oct-06 23:00
Cedric Moonen19-Oct-06 23:00 
GeneralRe: returning const member data Pin
minkowski19-Oct-06 23:01
minkowski19-Oct-06 23:01 
GeneralRe: returning const member data Pin
Cedric Moonen19-Oct-06 23:12
Cedric Moonen19-Oct-06 23:12 
AnswerRe: returning const member data Pin
prasad_som19-Oct-06 23:06
prasad_som19-Oct-06 23:06 
GeneralRe: returning const member data Pin
minkowski19-Oct-06 23:16
minkowski19-Oct-06 23:16 
QuestionBitmap Printing Pin
kk.tvm19-Oct-06 22:37
kk.tvm19-Oct-06 22:37 
AnswerRe: Bitmap Printing Pin
Hamid_RT20-Oct-06 0:06
Hamid_RT20-Oct-06 0:06 

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.