Bitwise»Forums
Aravind
2 posts
Declaration of list of statements
Edited by Aravind on Reason: Initial post
Hi

This might be a really silly question:
For a list of statements why is the declaration
BUF(Stmt **stmts) rather than BUF(Stmt *stmts) ?
Mārtiņš Možeiko
2237 posts / 1 project
Declaration of list of statements
Edited by Mārtiņš Možeiko on
If you have "int" type and want to have an array of ints then you do "int *" (add an asterix) to point to first element of array
If statement is "Stmt *" type, then to have an array of statements you add an asterix and get "Stmt **". This means you can point to first element of array with "Stmt *" elements - each array element is pointer itself.
Kiril Osiyuk
4 posts
Declaration of list of statements
1
Stmt **stmts
means
1
stmts
is pointer to and/or array of
1
Stmt *
elements
Aravind
2 posts
Declaration of list of statements
Edited by Aravind on
Got it guys, thanks for the reply.