in which language are definitions of built in functions like printf written...assembly or C?

Its in C itself.
It is compiled and object is created which is archived in library.

Also in assembly.

m a bit confused...how can it b written in C coz again u will need a C compiler to compile it..
also if it is written in assembly..then how can the code run on different machines..i mean,assembly language would be different for different architectures,won't it..??

sry..bt is this related to the same context..???

m a bit confused...how can it b written in C coz again u will need a C compiler to compile it..

Yeah, so? You compile C-version-6 with the compiler C-version-5 and you have an updated compiler.

also if it is written in assembly..then how can the code run on different machines..i mean,assembly language would be different for different architectures,won't it..??

If only standard C is written, the source can be built on different systems which makes them run on the architecture built on. For those things that are architecturally specific, like I/O, different code is written for each architecture.

They are written in C language only

m a bit confused...how can it b written in C coz again u will need a C compiler to compile it..
also if it is written in assembly..then how can the code run on different machines..i mean,assembly language would be different for different architectures,won't it..??

printf() is not a built-in function, but instead it is a library function, and all library functions are compiled with the C compiler. C compilers do not have any built-in "functions".

How library functions are written is up to whoever wrote the compiler, or is implementation dependent. Microsoft may write it in C language, but Borland might write it in assembly. Microsoft has actually done it both ways with various compilers.

Its true that assembly language functions restrict their use to only one architecture. Such fucntions have to be completly rewritten to port to others.

Yeah, so? You compile C-version-6 with the compiler C-version-5 and you have an updated compiler.

And that's the Chick & Egg dilemma. What did K&R use the build the first C compiler (see the answer here)?

Older "C" compilers actually converted "C" source to assembler source and then assembled and linked the code to create the final object.

k thnks ancient dragon..tht was helpful...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.