C Right-Left Rule (Rick Ord's CSE 30
cseweb.ucsd.edu·1d
♻️Interning
Preview
Report Post
The "right-left" rule is a completely regular rule for deciphering C
declarations.  It can also be useful in creating them.

First, symbols.  Read

*		as "pointer to"			- always on the left side
[] 	as "array of"			- always on the right side
()		as "function returning"		- always on the right side

as you encounter them in the declaration.

STEP 1
------
Find the identifier.  This is your starting point.  Then say to yourself,
"identifier is."  You've started your declaration.

STEP 2
------
Look at the symbols on the right of the identifier.  If, say, you find "()"
there, then you know that this is the declaration for a function.  So you
would then have "identifier is function returning".  Or if you found a
"[]" there, you would say "identifier is array of".  Continue right until
you r...

Similar Posts

Loading similar posts...