can someone show me an example of how you would initiate a variable and how you would fix a undeclaired identifiers.

i am a visual learner so thats why i ask for an example.

Recommended Answers

All 2 Replies

>>can someone show me an example of how you would initiate a variable.

int variable = 0; //declare and initialize the variables

>>how you would fix a undeclaired identifiers.

an undeclaried identifier means that you used a variables that has not
been declared. For example :

int n = 1;
int m = 2;
sum = n + m; //error indeclared identifier

The way to solve this problem is to declare the variable. In the above
code, you need to declare the variable sum. So the correct code should be :

int n = 1;
int m = 2;
int sum = n + m; //notice the "int sum" part. Thats the declaring the variable part.

Initializing a variable:

char Test = "Initialized";

Declare a variable:

int Declared;

Undeclared variable:

Undeclared;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.