Basic and Advance C Question:
Download Job Interview Questions and Answers PDF
How can I shut off the warning ...
Answer:
How can I shut off the ``warning: possible pointer alignment problem'' message which lint gives me for each call to malloc?
A modern lint shouldn't be complaining about this.
Once upon a time, lint did not and could not know that malloc ``returns a pointer to space suitably aligned for storage of any type of object.'' There were various kludgey workarounds for this problem, but today, the void * type exists precisely to encapsulate the notion of a ``generic'' pointer, and an ANSI-compatible lint should understand this.
A modern lint shouldn't be complaining about this.
Once upon a time, lint did not and could not know that malloc ``returns a pointer to space suitably aligned for storage of any type of object.'' There were various kludgey workarounds for this problem, but today, the void * type exists precisely to encapsulate the notion of a ``generic'' pointer, and an ANSI-compatible lint should understand this.
Download C Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
Where can I get an ANSI-compatible lint? | I just typed in this program, and it is acting strangely. Can you see anything wrong with it? |