What does this mean in C language? [duplicate] - c++

This question already has answers here:
What is the meaning of prepended double colon "::"?
(9 answers)
Closed 9 years ago.
What does this do in C language and please explain this with simplified example ?
void KidLogic::doCommand()
{ }

In C, it doesn't mean anything.
This is C++, and it means the KidLogic namespace or class has a doCommand function doing nothing.

It looks like C++, not C.
It is a definition of the method doCommand for class (or namespace) KidLogic.

Related

What does int arr[10]{} this declaration in C++ means? [duplicate]

This question already has answers here:
Use of Curly Brackets (Braces) Around a variable C++
(4 answers)
Initialization difference with or without curly braces in C++
(3 answers)
What are the advantages of list initialization (using curly braces)?
(5 answers)
When should we use parenthesis ( ) vs. initializer { } syntax to initialize objects in C++11? [duplicate]
(2 answers)
When to use the brace-enclosed initializer?
(3 answers)
Closed 3 months ago.
int fr[10]{}
I seen this declaration in C++ is this 1-D array or it is 2-D. Which type of declaration it is?
C++ since its version 11 has introduced in its standard the use of curly brackets for the initialization of objects.
Here are some examples:
MyObjects obj {};
MyObjects obj {firstParameter};
int array[10] {};
In the latter case, it refers to the fact that it will contain 10 elements initialized as zero in it. In the case of the standard types you will see what was written in the memory cell first
Here you will find a precise explanation of all this

What does it mean if you add '&'before the variable, while declaring it? [duplicate]

This question already has answers here:
What does '&' do in a C++ declaration?
(7 answers)
Closed 2 years ago.
What is the difference between int &r and int r?
I'm new to this
First keep in mind that int& r and int &r are syntactically the same thing: r is a variable of type int&. So r is an integer reference.
To learn more about references in C++, there are plenty of online guides. Here's one: https://www.embedded.com/an-introduction-to-references/

Is it possible to overload the "evaluation operator"? [duplicate]

This question already has answers here:
Which operator to overload in order to use my class in an if-statement? [duplicate]
(4 answers)
How do I override the bool operator in a C++ class?
(4 answers)
User Defined Conversions in C++
(4 answers)
Closed 4 years ago.
I am familiar with operator overloading, but a question popped up in my mind.
Is it possible to overload how an object behaves upon evaluating it without any operator? Such as:
Object foo;
if(foo){...}
So i can overload the evaluation with something like:
bool operator evaluation(){
bool isValid=false;
//Some instructions and conditions
return isValid;
}
There's probably little to no reason to do something like this, but I'm a bit new to C++ and I'm just exploring all nooks and crannies of it.
Thank you!

*& Pointer in C program [duplicate]

This question already has answers here:
What does `*&` in a function declaration mean?
(8 answers)
Closed 8 years ago.
I am Converting a C++ code into C program. I come across a function that takes void draw(char *&a). how to write this function *& in C program. I tried using same *&a but it is showing , (...etc expected. Please help.
Thanks
There is no pass by reference in C. Therefore you need to change the function declaration to
void draw(char **a)

C++ ClassName::GetSth(TypeName* &pSth) [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
what’s the meaning of *&
what * &pSth mean?
is this a pointer or a ref?
Why/When we need that?
--code--
ClassName::GetSth(TypeName* &pSth)
{
//some code
}
It means "reference to pointer to Typename".
TypeName* &pSth is a reference to TypeName pointer.
Equivalent syntax in C is TypeName** pSth