Click here to Skip to main content
15,888,521 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Rajesh R Subramanian10-Dec-10 0:30
professionalRajesh R Subramanian10-Dec-10 0:30 
AnswerRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Gary R. Wheeler11-Dec-10 1:31
Gary R. Wheeler11-Dec-10 1:31 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
yccheok12-Dec-10 18:51
yccheok12-Dec-10 18:51 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Gary R. Wheeler13-Dec-10 11:45
Gary R. Wheeler13-Dec-10 11:45 
QuestionPassing Array To Function & Displaying Array Contents. Pin
Mike Certini9-Dec-10 18:41
Mike Certini9-Dec-10 18:41 
AnswerRe: Passing Array To Function & Displaying Array Contents. Pin
Cedric Moonen9-Dec-10 20:25
Cedric Moonen9-Dec-10 20:25 
GeneralRe: Passing Array To Function & Displaying Array Contents. Pin
Mike Certini10-Dec-10 8:10
Mike Certini10-Dec-10 8:10 
GeneralRe: Passing Array To Function & Displaying Array Contents. Pin
Stefan_Lang14-Dec-10 6:54
Stefan_Lang14-Dec-10 6:54 
As Cedric already said, you really should get a good book, there's just too many problems with your code way beyond the syntactical issues your compiler complains about.

The latter is due to your apparent misunderstanding on the scope of variables in C/C++. If you declare a variable, this variable is only known within the scope it is declared in. In most cases this scope is between the previous opening '{' and the corresponding closing '}'. There are basically two exceptions: If you define a variable within the definition of a class (or a struct), then every function that is also defined as a member of that class has access to it. The other exception is when you declare a variable outside a function or class (or struct), which makes it a global variable. Global variables may be accessed anywhere, provided it's declaration comes prior to the location where it's defined. Check your C/C++ book of choice for further explanations on how to declare and access global variables. However, it is a good practice to keep the number of global variables to a minimum.

The compiler states that PropNameArray is an undeclared identifier because within the scope of the main function, the variable PropNameArray is not known. It is only known within the function PropInit(), where this variable was declared.

Note that all variables will be automatically destroyed when program execution leaves the scope they are declared in. In other words, when you execute the function PropNameInit(), the system will first create all these variables, then initialize them, and, when it leaves the function, immediately destroy them again. As has been pointed out in another response, the function PropInit() currently does nothing! You have three options:

1. Make the variables global (which is bad design).
2. Create the variables outside of the function (i. e. in main) and pass them as arguments to the function PropInit (which is impractical)
3. Declare these variables as attributes of the class

Hope this helps to get you started, but like stated before, do yourself a favor and get a book.
AnswerRe: Passing Array To Function & Displaying Array Contents. Pin
Niklas L10-Dec-10 21:13
Niklas L10-Dec-10 21:13 
QuestionApplication crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 11:05
XTAL2569-Dec-10 11:05 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
mbue9-Dec-10 11:49
mbue9-Dec-10 11:49 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 12:19
sitebuilderLuc Pattyn9-Dec-10 12:19 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 13:11
XTAL2569-Dec-10 13:11 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 13:16
sitebuilderLuc Pattyn9-Dec-10 13:16 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 17:48
XTAL2569-Dec-10 17:48 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 22:47
sitebuilderLuc Pattyn9-Dec-10 22:47 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 23:21
XTAL2569-Dec-10 23:21 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Rajesh R Subramanian9-Dec-10 17:26
professionalRajesh R Subramanian9-Dec-10 17:26 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL25612-Dec-10 12:09
XTAL25612-Dec-10 12:09 
QuestionC Casting Problem Pin
Andy2029-Dec-10 8:14
Andy2029-Dec-10 8:14 
AnswerRe: C Casting Problem Pin
Luc Pattyn9-Dec-10 9:01
sitebuilderLuc Pattyn9-Dec-10 9:01 
GeneralRe: C Casting Problem Pin
Andy2029-Dec-10 10:41
Andy2029-Dec-10 10:41 
GeneralRe: C Casting Problem [modified] Pin
Luc Pattyn9-Dec-10 11:06
sitebuilderLuc Pattyn9-Dec-10 11:06 
AnswerRe: C Casting Problem Pin
mbue9-Dec-10 12:07
mbue9-Dec-10 12:07 
QuestionSave image from picturebox use MFC Pin
josipahutar9-Dec-10 8:02
josipahutar9-Dec-10 8:02 

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.