+ 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.
6 Respuestas
+ 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
+ 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
+ 3
It's a question asked in quiz..
+ 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
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? ^^