point of view in a language concept
manner:
"Can i say that printf is a command in C language?"
I think Yes bcos it's a keyword in C and only found in C (i think)
thnx for the help
point of view in a language concept
manner:
"Can i say that printf is a command in C language?"
I think Yes bcos it's a keyword in C and only found in C (i think)
thnx for the help
why do you think it is a keyword?
It is not.Code:int main() { int printf = 5; return printf; }
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
I wouldn't use the term 'command' or 'keyword' for printf -- I would call it a 'C standard library function' (which was also incorporated into C++).
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
But how can you set a keyword as a variable name?
i think I'm lacking some basic knowlage, can anybody give me some good explanation?
keyword cannot be used as a variable name. printf is not a keyword.
it is a function name declared in the stdio.h
if this header file is not included - this function is not declared. so this name can be used for something else.
I don't say that it is a good thing to do. But still it is possible to do...
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Yeah thanks Got the idea
thank you
I'm studing programming languages and concepts this year as a subject.
so in that point of view can i say "printf is a part of C"
i think it is, even though it is not a keyword, Still it is defiened as function in stdio.h header file.
any wide comment
thnx
No, it is a part of the Standard C Library, which isn't needed to make a program in C -- Consider the Linux Kernel. . .
as said before
printf is a C-standard library function.
it is declared in the stdio.h
its definition is contained in the c run-time (CRT) library, that should be linked together with the project if some of the functions from this library is used.
The VC6 for example supplies several versions of this library for release and debug, for sigle and multithreaded project as a static lib or dynamic lib
Function definition contains its body
Function declaration - only the prototype used to call it correctly.
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Sorry Dumb question
but anyway it is altogether belongs to C language?
What defnition do you give to "PART" word in my question?
thnx
Last edited by kusal; 01-06-2007 at 12:11 PM.
No, printf could be LINKED via another programming language. . . for example Assembly. Therefore it is a PART of the standard C library, in other words a conglomeration of functions needed to do standard things. . . such as I/O, memory management, etc. Long ago, just when C first started, there was no C Library. . . just C. There was a few different I/O libraries out there written in Assembly for C, however, when C first started there was no STANDARD _ANYTHING_. OR. . . no printf.
Thnx got the idea