Thread: in stdio.h there is no function printf. All I see is this?

  1. #1
    Registered User
    Join Date
    Nov 2017
    Posts
    34

    Unhappy in stdio.h there is no function printf. All I see is this?

    Below is the screenshot of code snippet from stdio.h

    in stdio.h  there is no function printf. All I see is this?-print-png

    Below is the attachment of my stdio.h file which is Pelles C file.

    stdio.h

    Please look at it and help me find out where is printf!!
    All I see is declaration and no ACTUAL FUNCTION BODY!!

  2. #2
    Informer -Adrian's Avatar
    Join Date
    Jan 2013
    Posts
    830
    The function would likely be compiled into a library already, so you won't find sourcecode for it. I don't know how Pelles C does things, and had no luck finding its source code (the implementation might be closed source).

  3. #3
    Registered User
    Join Date
    Nov 2017
    Posts
    34
    Quote Originally Posted by -Adrian View Post
    The function would likely be compiled into a library already, so you won't find sourcecode for it. I don't know how Pelles C does things, and had no luck finding its source code (the implementation might be closed source).
    Ok Adrian so which library is it compiled into? Further more what are libraries? Are they in machine language? They are not .exe file , so they contain machine code which can't be executed but used in programs? Right? Help!

  4. #4
    Registered User
    Join Date
    Nov 2017
    Posts
    34
    Quote Originally Posted by -Adrian View Post
    The function would likely be compiled into a library already, so you won't find sourcecode for it. I don't know how Pelles C does things, and had no luck finding its source code (the implementation might be closed source).
    Furthermore what is _CRTCHK(printf , 2 , 3) int __cdecl fprintf(............etc).. what does it mean?
    Im a beginner , I know C but want help for advanced topics. Please help!

  5. #5
    Informer -Adrian's Avatar
    Join Date
    Jan 2013
    Posts
    830
    _CRTCHK is likely a macro defined elsewhere, maybe to reduce repetitive typing and to allow changes in a single place to propagate to many headers/function declarations. I'm not much of a C guy, so someone else can explain this much better.

    Libraries are pre-compiled code that you can link with your program (most prominently libc). This way, you don't need to (re)compile everything yourself when writing a C program. You just include the header files into the code you write and the linker later combines the library code (e.g. the implementation of printf) with yours. Dynamic linkage also allows you to switch out the library for a different version (e.g. a newer one with fixed bugs) without touching your program at all!
    Last edited by -Adrian; 11-28-2017 at 05:28 AM. Reason: typo

  6. #6
    Registered User
    Join Date
    Nov 2017
    Posts
    34
    Quote Originally Posted by -Adrian View Post
    _CRTCHK is likely a macro defined elsewhere, maybe to reduce repetitive typing and to allow changes in a single place to propagate to many headers/function declarations. I'm not much of a C guy, so someone else can explain this much better.

    Libraries are pre-compiled code that you can link with your program (most prominently libc). This way, you don't need to (re)compile everything yourself when writing a C program. You just include the header files into the code you write and the linker later combines the library code (e.g. the implementation of printf) with yours. Dynamic linkage also allows you to switch out the library for a different version (e.g. a newer one with fixed bugs) without touching your program at all!
    Ok Thanks Adrian. I'm a simple young adult 20 years old , dropped out of college with a will to learn programming. I earn very less , so all I learn is from you guys , don't have money to buy many books , so I'm trying to grab C in my belt to the extreme point so that I can apply for a programmer job and move forward. You guys are my only guide.

    If you do know some C person , please refer me to him , I want to learn more. Thanks Sir

  7. #7
    Informer -Adrian's Avatar
    Join Date
    Jan 2013
    Posts
    830
    In the 21st century, a lot of information (even good one) is free so lack of money doesn't have to keep you from learning. Look for free online courses on sites like edx.org, I suspect those are of good quality too.

    I used one book (for C++ in my case) and the rest I learned from documentation and other users.

    What I would strongly encourage though is that you start using a Linux system, because C is much more at home there, and it's conductive to programming in general. The user base is also far more geared towards these things so resonance/critique/help is easily gotten.

    If you do know some C person , please refer me to him , I want to learn more.
    Right now few registered users are online. Later today people will show up that know this stuff, so all you can do is wait. Also consider IRC chat, like ##C on freenode, where you may get quicker answers.
    Last edited by -Adrian; 11-28-2017 at 06:20 AM.

  8. #8
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    110
    Quote Originally Posted by ranadas View Post
    Ok Thanks Adrian. I'm a simple young adult 20 years old , dropped out of college with a will to learn programming. I earn very less , so all I learn is from you guys , don't have money to buy many books , so I'm trying to grab C in my belt to the extreme point so that I can apply for a programmer job and move forward. You guys are my only guide.

    If you do know some C person , please refer me to him , I want to learn more. Thanks Sir
    I suggest to read a book on C like K&R. Then do some project and ask your questions.
    Last edited by ordak; 11-28-2017 at 07:14 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to printf a function
    By SquareDance in forum C Programming
    Replies: 6
    Last Post: 11-19-2017, 12:04 PM
  2. printf-like function ?
    By Algar in forum C Programming
    Replies: 3
    Last Post: 01-02-2013, 01:35 PM
  3. Simulating printf function
    By wu_weidong in forum C Programming
    Replies: 2
    Last Post: 03-20-2005, 12:14 PM
  4. printf like function
    By tyouk in forum C Programming
    Replies: 5
    Last Post: 11-17-2003, 07:26 PM
  5. printf like function
    By argon in forum C Programming
    Replies: 2
    Last Post: 10-07-2003, 03:12 PM

Tags for this Thread