Navigation des fichiers:
Return To Mecca noblibrary.com
Offline. Book. Use the navigation toolbar to navigate the collection.
Return to Mecca. Returning to Mecca by Lipkin, Dennis Avi — Publisher: Avon EBook — Page: 146. What is a Return to Mecca? Having fought against Saddam, she.
Return To Mecca - Kindle edition by Lipkin, Dennis Avi. Download it once and read it on your Kindle device, PC, phones or tablets.
Download paper book free :
Return to Mecca for Kindle: Amazon.com: Lipkin, Dennis Avi: Books.Q:
C/C++ : Problems with fprintf in a function and in main
I'm learning C/C++, I want to write a function that takes a string and prints it to standard out. The code is as follows:
#include
void println(const char* str)
{
printf("%s", str);
}
int main()
{
printf("Hello, World!
");
printf("I'm in main()
");
printf("%s
", "Hello, World!");
println("Hello, World!");
printf("Hi, World!
");
printf("I'm in main()
");
printf("%s
", "Hi, World!");
println("Hi, World!");
return 0;
}
When I compile this, the code works great and outputs:
Hello, World!
I'm in main()
Hello, World!
Hi, World!
I'm in main()
But when I take out the println() function and put it in the main() function it doesn't work. It does however, when I put the println() function into the main() function.
The reason I put the println() function in the main() function is that I will eventually want to print out strings from a linked list.
A:
When you define a function as a non-member, it hides the class member of the same name. Since println() is a class member, main() does not see it and instead calls printf(). If you ac619d1d87
Related links:
Comments