Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
C compiler reads from right to left or left to right?
can any one describe it?
Posted

The C compiler reads from the beginning of the file to the end and processes each statement completely before moving on to the next. Forward declarations are noted and the details filled in as they are encountered. There are more details about the linker which I will spare you here.

If you are asking about logical expressions within a source line, the order that the compiler 'reads' is irrelevant. There is short circuit logic however such that a statement such as

C++
if(x && *x > 3)
{ ... }


is executed from left to right and terminates when a false condition is encountered.
 
Share this answer
 
How the compiler reads the input is an implementation detail. How the statements or expressions are evaluated is a bit complex. For instance most expression operators are left associative (that is are left to right) but there is also operator precedence (and the use of braces) to take into account.
Logical expressions in if statements are left to right (with shortcut) while the comma operator is right to left.
You should check out the documentation to get insight.
 
Share this answer
 
It reads start to end. Why do you ask?
 
Share this answer
 
i heard that it puts each keyword in stack and process it
thus it becm right to left ,ie: from end of the line to start
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900