Thread: Problem with stdio.h!!

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

    Problem with stdio.h!!

    Whenever I write the the following code in Pelles C it runs fine without including the stdio.h header file!! I donot know why??

    I'm running Pelles C!

    Forgive me for using deprecated Trigraphs and digraphs to use in this code!

    Code:
    %:include <iso646.h>
    
    #define C (char)
    
    int main(void)
    ??<
        int x;
        char c=C'<:';
        printf("Hello World");
        printf("\nCan you please enter a number%:");
        scanf("%d",&x);
    
        //Will the next text be executed??????????????
        if(67 + x <100)
        <%
            printf("True\n");
            printf("\n%c",64);
            printf("\n%c",c);
        %>
    ??>

    All the compiler really generates is some warning for not including the stdio.h header file


    like this:Undeclared function 'printf' (did you mean 'main'?); assuming 'extern' returning 'int'.

    Undeclared function 'scanf' (did you mean 'printf'?); assuming 'extern' returning 'int'.


    So my question is that , is printf() and scanf() compiled into a library file which is automatically called whenever a program is compiled in Pelles C?

    For which the code still works , if so what is the name of the library file

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Header files have nothing to do with whether a library is included or not.

    Header files help to ensure compatibility between the caller and the library.

    Depending on the strictness of your compiler, you can get away with all sorts of nonsense.

    And yes, the compiler automatically links with libc, which is where printf etc are to be found.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Banned
    Join Date
    Aug 2017
    Posts
    861
    Pelles C? you know their is GCC for windows out there too. that you MIGHT want to give a try. Because with all of your post on this fan dangle of free C for windows it seems not very standard C even. But I may be wrong in that department, only stating their is GCC for windows out there too, I have not tried it. I use it on Linux.
    It does not hurt to look.
    Cygwin
    MinGW | Minimalist GNU for Windows
    Mingw-w64 - GCC for Windows 64 & 32 bits [mingw-w64]

    if you're not programming for PDA's specify then you might want to give gcc a look. there are also many or some in here that I've seen saying they use DEV C++
    Dev-C++ download | SourceForge.net
    they maybe a bit more straight forward and less confusing. If you want to dig into the bones of it all.

  4. #4
    Registered User
    Join Date
    Sep 2017
    Posts
    93
    IMO, Clang + Cygwin is a pretty good setup on Windows.

    Or if you just want to program for Windows, get Visual Studio. It's free.

    I use macOS, Linux/*BSD, and Windows. Since I use macOS and *BSD, I try to just use Clang for everything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. my stdio, buffer I/O
    By mmhzhummer in forum C Programming
    Replies: 14
    Last Post: 11-29-2010, 03:51 AM
  2. stdio.h?
    By kiros88 in forum C Programming
    Replies: 5
    Last Post: 05-21-2010, 07:09 PM
  3. SDL and stdio.h
    By a.mlw.walker in forum C Programming
    Replies: 1
    Last Post: 02-06-2009, 07:45 AM
  4. stdio.c???
    By DJTurboToJo in forum C Programming
    Replies: 6
    Last Post: 03-26-2008, 01:20 PM
  5. stdio.h
    By Vertex34 in forum C Programming
    Replies: 2
    Last Post: 07-12-2004, 10:18 AM

Tags for this Thread