What I want to do is simple, however I can not find a way to do it in c++ and I don't know for sure that it is possible. I want to create a function that creates a simple short-hand for printf(x); Such as:
1 2 3
void echo(x){
printf(x);
}
But when I call the function:
1 2 3
echo "hi";//I want it to look like this
//instead of:
echo("hi");// like this.
The problem with using #define is that it doesn't respect scoping rules. It simply replaces all occurences of echo in the program with std::cout<< so I don't recommend this.
In C++ you need () or other operators (such as *,+,- etc.) to call functions. You may be able to set something dirty up using macros, but you're guaranteed to be frowned upon. You could also use user defined literals to get something similar, but again, this is abusing language features.
The short answer is: You can't.