How to use scanf() without including stdio.h

c

Solution

You can declare the `scanf` function with:

extern int scanf(const char *format, ...);

The extern keyword is optional but I like to include it as a reminder of the fact that the function is defined elsewhere.

Your example would then look like:

extern int scanf(const char *format, ...);

int main ()
{
  char str [80];
  scanf ("%s",str);  
  return 0;
}

Problem

Is there any possible methods to write a C program without including `stdio.h` as a header file. It was suggested that it can be implemented by declaring `extern int scanf(char* format, ...);` ``` #include <stdio.h> //I want this same code to work without including this line int main () { char str [80]; scanf ("%s",str); return 0; } ```

Original source