Sunday 15 February 2015

c - Trying to understand how undcl works (From K&R book - chapter 5-12 Complicated Declarations) -


I am confused about how undcl works. Here is the code given by R & R Book

  .... int main () {int type; Four Temporary [Maxcocaine]; While (gettoken ()! = EOF) {strcpy (outside, token); While ((type = gettoken ())! = '\ N') if (type == PARENS || type == BRACKETS) strcat (outside, token); And if (type == '*') {sprint (temporary, "(*% s)", outside); Strcpy (outside, temporary); } And if (type == NAME) {sprintf (temp, "% s% s", token, out); Strcpy (outside, temporary); } And printf ("% s \ n" invalid input, token); } Return 0; } ....   

What do I think of input here? I tried typing the word to declare the word in the input, but it does not seem to work

Example I run the program and I type it:

Argv: pointer to pointer char

and it only shows an 'invalid input' error on the argv

The book will give you an example of the input immediately above the code, i.e.:

  x () * [] * () char   

which is "A Brief input syntax "meaning" X is a function that returns pointers to functions that return pointers in the array. "

Try entering it, and you should get the following output:

  char (* (* x ()) []) ()    

No comments:

Post a Comment