News for hackers. Stuff that matters.
Re:Computer Science Interview Questions with C++ Solutions by NAFV_P on Sunday December 22, 2013 @06:06PM (#6952187)
Sorry I should have explained myself better:

I am referring to the C-standards, and I don't consider K&R to be one of them. I tried compiling the source with:

  gcc file -std=c89 -Wall -o out
&&

  gcc file -std=c99 -Wall -o out
I get a score of errors thrown at me.

Not one of them mentioned a void* or char, they don't appear in the code. The float which holds the data is located within the struct itself.

The first nine errors were all practically identical:

  error: unknown type name 'LL_Element'
I don't know much c99, but when it comes to c89 whenever an instance of a struct some_type* is declared the keyword struct also has to precede the type: ie. struct some_type some_instance;. The only way I am aware of that overcomes this is the use of typedef in the original declaration.

I'll have to check whether it is mentioned in the 1988 edition of The C programming language or another text, but if I recall correctly the term tag is used to refer to struct declarations.

Also the original code had the headers <cstdlib> && <cstdio>. I think these headers have all their functions declared as inline, a non-existent keyword with regards to c89. I had to change the headers to the traditional .h style header in order to have a chance of getting the code to fit through the slot, so to speak.

I don't have a CS degree, I teach myself, so if I have missed something or made a faux pas, please say so.

There are no comments on this comment yet.