unary-operator Questions
2
Solved
Given the infix expression -190 + 20, what would the correct result look like as RPN?
-190 + 20 == -190 20 + ?
or..
-190 + 20 == 190 - 20 + ?
Are the rules for unary operators (negative) the same a...
Disputation asked 17/11, 2020 at 1:17
16
Solved
What does the unary plus operator do? There are several definitions that I have found (here and here) but I still have no idea what it would be used for. It seems like it doesn't do anything but th...
Mallon asked 7/4, 2009 at 20:44
7
Solved
In JavaScript you can use ++ operator before (pre-increment) or after the variable name (post-increment). What, if any, are the differences between these ways of incrementing a variable?
Roquelaure asked 12/8, 2010 at 16:30
3
Solved
I'm trying to switch boolean field using the following hql:
update Entity e set e.booleanField = not e.booleanField where e.id = ?1;
Unfortunately "QuerySyntaxException: unexpected token: not ne...
Andvari asked 25/4, 2012 at 14:15
3
What does this perl snippet with unary plus do?
join( '/', splice @t, 0, +@d )
This is from File::Path.pm line 267, and I'm trying to understand it. According to the documentation, unary plus does...
Uralite asked 7/4, 2022 at 4:47
3
Solved
Seeing some stranger behavior in Java regarding functional interfaces with void return type.
Can someone please explain why the declarations for task5 and task6 below compile?
public class Test {
...
Oleum asked 11/3, 2021 at 17:50
4
Solved
I can't seem to find the relevant parts in the C standard fully defining the behavior of the unary minus operator with unsigned operands.
The 2003 C++ standard (yes, C++, bear with me for a few li...
Pandean asked 6/11, 2011 at 11:30
1
Solved
int[] numbers = new int[10];
numbers[9] = 10;
Console.Write(numbers[^1] == numbers[numbers.Count()-1]); //true
How does index of ^1 returns the last item in an array?
What does ^1 mean in C#...
Elsy asked 26/10, 2020 at 9:57
9
Solved
What is the difference between += and =+?
Specifically, in java, but in general also.
Acker asked 30/5, 2010 at 14:33
4
I'm trying to use the any_of function on a vector of bool's. The any_of function requires a unary predicate function that returns a bool. However, I can't figure out what to use when the value inpu...
Furnary asked 24/12, 2013 at 17:27
9
Solved
Was the unary + operator only included for symmetry with the unary - operator, or does it find some practical use in C++ code?
Searching here, I came across What is the purpose of the unary '...
Slit asked 16/1, 2013 at 19:1
1
Solved
Although this question might be answered somewhere and I could not find it.
Below written first statement work whereas second does not? WHY?
int main() {
int x = 1, y = 2;
int *p = &++x; /...
Miltiades asked 8/4, 2020 at 19:21
2
Solved
My code is:
#include <stdio.h>
#include <string.h>
void main()
{
char string[10];
int A = -73;
unsigned int B = 31337;
strcpy(string, "sample");
// printing with different for...
Calderon asked 20/5, 2015 at 15:29
5
Today I stumbled over a C riddle that got a new surprise for me.
I didn't think that -1[p] in the example below would compile, but it did. In fact, x ends up to be -3.
int x;
int array[] = ...
Mercantile asked 14/8, 2019 at 17:18
4
Solved
How does apply() method work in Java?
Regarding the UnaryOperator functional interface, I have read the documentation, it says
@FunctionalInterface
public interface UnaryOperator<T> extends...
Highwayman asked 27/6, 2019 at 4:2
2
Solved
I write this code, but I don't know why it compiles.
The UnaryOperator takes a specific type argument and returns the result with the same type of its argument.
My question: if I put an if-state...
Imperception asked 12/11, 2018 at 15:1
3
Solved
Apart from making a nice symmetry with unary minus, why is unary plus operator defined on Numeric class? Is there some practical value in it, except for causing confusion allowing writing things li...
Duenna asked 15/4, 2011 at 17:58
1
Following this question on the plus operator I have a follow-up question. We know the difference between plus and uplus, and thus that 1+2 resolves to 3, just as 1++2 or even 1++++++++2. The strang...
Alarise asked 5/10, 2018 at 11:8
3
Solved
What is the difference between these unary operators in C#?
What would an example be? What is the name of each?
+= vs. =+
++x vs. x++
Badmouth asked 6/2, 2015 at 3:47
4
Solved
I saw this example in cppreference's documentation for std::numeric_limits
#include <limits>
#include <iostream>
int main()
{
std::cout << "type\tlowest()\tmin()\t\tmax()\n\n"...
Reahard asked 3/9, 2018 at 8:43
3
Why does the following swift code bring me the error "Unary operator '++' cannot be applied to an operand of type 'Int'" ??? (using swift-1.2 on Xcode-6.3.2)
struct Set {
var player1Games: Int
...
Mantissa asked 27/5, 2015 at 8:29
5
Solved
I saw a weird type of program here.
int main()
{
int s[]={3,6,9,12,18};
int* p=+s;
}
Above program tested on GCC and Clang compilers and working fine on both compilers.
I curious to know, What d...
Adon asked 30/5, 2018 at 6:56
3
In the following code, are the functions test and test2 equivalent?
typedef int rofl;
void test(void) {
rofl * rofl = malloc(sizeof(rofl)); // Is the final rofl here the TYPE?
}
void test2(void...
Swinge asked 15/11, 2017 at 1:15
3
Solved
I'm still learning functional interfaces. I'd like to know why I'm able to chain a UnaryOperator to the end of a Function, but not an IntUnaryOperator to the end of the same Function.
UnaryOperato...
Cornelison asked 17/8, 2017 at 7:16
1
Solved
[conv]/4:
Certain language constructs require that an expression be converted to
a Boolean value. An expression e appearing in such a context is said
to be contextually converted to bool and i...
Taunyataupe asked 21/6, 2017 at 14:39
1 Next >
© 2022 - 2024 — McMap. All rights reserved.