very basic C question--K&R on a Mac

  • Thread starter Ben Jacobs-Swearingen
  • Start date
D

Dan Pop

In said:
K&R is full of example functions,
which have the same name as standard functions.
It is something that you will have to continue to watch out for.

Easier said than done. How is a beginner supposed to know the names
of the standard library functions?

Dan
 
P

pete

Dan said:
Easier said than done. How is a beginner supposed to know the names
of the standard library functions?

He'll have to look up all of the functions from the chapters,
in the index,
to find out if they are also the names of library functions.
 
D

Dan Pop

In said:
He'll have to look up all of the functions from the chapters,
in the index,
to find out if they are also the names of library functions.

This is the last thing you want to do when reading K&R2 for the first
time: it breaks your focus on the things that really matter at that point.

You can start worrying about standard library function names later, by the
time you're fit for studying Appendix B.

Dan
 
P

pete

Dan said:
That document is not an accurate reference for *any* C standard (it
contains plenty of functions that are not part of the standard
C89 library
and it's missing at least one function from the standard C99 library),
so why should he bother?

His problem is that he's compiling functions from K&R,
some of which have the same names as some standard library functions.

Any function in K&R1, which is defined in N869,
is part of the C89 standard library.
Any function in K&R1, which is not defined in N869,
is not part of the C89 standard library.

N869 is free, and the point of using K&R1,
is that his resources are limited.
"I can't afford the newer second edition"
 
D

Dan Pop

In said:
His problem is that he's compiling functions from K&R,
some of which have the same names as some standard library functions.

Could you, please, point out, which functions that have the same names as
some standard library functions is he using? I can't find any conflict
between the names used by the last example in chapter 5 and the standard
C library. Sure, the program uses printf, strcmp and atof, but it doesn't
define them.

His problem is that his implementation declares some of the user name
space identifiers used by that program, most likely as macros.
Any function in K&R1, which is defined in N869,
is part of the C89 standard library.
Any function in K&R1, which is not defined in N869,
is not part of the C89 standard library.

How could this help him with his problem? Neither comp nor exch, the
identifiers creating him problems, are mentioned in N869 as macro names,
are they?
N869 is free, and the point of using K&R1,
is that his resources are limited.
"I can't afford the newer second edition"

It might be free, but it doesn't solve his problem. So, what exactly is
your point?

Dan
 
P

pete

Dan Pop wrote:
Could you, please, point out,
which functions that have the same names as
some standard library functions is he using?

I may have misunderstood his problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top