Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Mikroelektronika MikroC

Not open for further replies.


Aug 29, 2015
Reaction score
Trophy points
Activity points
Hello Guys,

Please, I want someone to help me explain the meaning and uses of the following codes if possible with example:

(1) char old state = 0
(2) char oldstate2 = 0
(3) char oldstate = 1
(4) oldstate = 0
(5) oldstate = 1
(6) oldstate++;
(7) enum outputs {UTILITY_GEN = 0,GEN2_SHUTOFF = 1,GEN1_GEN2 = 2};

There's nothing mikroC specific with your specification, just plain C language. Any C text book or tutorial has the answer.
I'm still using Kernighan + Ritchie, The C Programming Language.

As written (1) will generate a syntax error as there is a space between "old" and "state".
Similarly, (1) to (5) are all missing the trailing semicolon but that could simply be a transcription error.
If (1) and (3) appear in the same source file (as seen by the compiler) at the same level, and the error I mentioned above is corrected for (1), then the compiler will complain of a duplicate definition. However without seeing the code snippets in context it is almost impossible to tell.

Thank you FvM and Aussie Susan for your response. Please, what I want is the meaning and how to use the undermentioned codes. I have read some books but I couldn't comprehend their meaning and uses. Guys, kindly assist me with their meaning, uses and if possible with example:

(1) char oldstate = 0;
(2) char oldstate2 = 0;
(3) char oldstate = 1;
(4) oldstate = 0;
(5) oldstate = 1;
(6) oldstate++;
(7) enum outputs {UTILITY_GEN = 0,GEN2_SHUTOFF = 1,GEN1_GEN2 = 2};


It seems to be very basic problem (that I actually don't see)

I'm not familiar with C, but I try to describe. (Any C specialist please correct any mistakes.)

"char oldstate = 0; "
The whole line is a variable declaratio with default value setup
* "char" is a variable type. Character = one byte
* "oldstate" is the variable name
* "=" is the operator to initialize the variable with a value
* "0" is the initial value of the variable.


1-3 variable declarations with initialisation
4-5 simple variable assignments to constant values
6 variable increment operation
7 declaration of a variable of the enum type

Examples and further explanations are in the above mentioned books.

Not open for further replies.

Part and Inventory Search

Welcome to