+ 2

If there is any way to print a value in C without using #include statement?

If I want to print a value in c. For that we use printf or other standard output statements. But without defining #include<stdio.h>, we can't use them. Do you find any other way to print it help me.

18th Feb 2018, 1:53 PM
Dinesh Kesawamoorthy
Dinesh Kesawamoorthy - avatar
6 ответов
+ 6
The only purpose of a header file is to provide the definition of items in the library. Provide the definition yourself and your golden. https://code.sololearn.com/ceRGNxAeuyO3
18th Feb 2018, 2:13 PM
John Wells
John Wells - avatar
+ 15
//Declare the printf() function inside //extern "C" for C++ compiler extern "C" { int printf(const char *format, ...); } int main() { printf( "Hello World" );   return 0; } Output:- Hello World
18th Feb 2018, 1:58 PM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 3
It's a question asked in quiz..
18th Feb 2018, 2:00 PM
Dinesh Kesawamoorthy
Dinesh Kesawamoorthy - avatar
+ 3
yes but you need to know which data type you want to display You can use asm macro (or function, I do not know) to print a string, but you will need to know how to translate your data type to a string
18th Feb 2018, 5:06 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
18th Feb 2018, 5:11 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
in theory: yes. the included header is just code the linker puts into placeholders the compiler left for statements like printf. if you copy everything you need in the studio header and paste it into you main cpp file it would compile it und it would run just like with including the file. But why would you want to do this? ^^
18th Feb 2018, 1:58 PM
Alex
Alex - avatar