Most voted "operators" questions
Operators are symbols that occur in almost every programming language and coding, for performing calculations and comparisons on data. Use the tag only when operators are relevant to the problem, including questions about syntax, in any language.
Learn more…330 questions
Sort by count of
-
2
votes1
answer132
views -
2
votes2
answers363
viewsif-Else command is not working
In one of the exercises of a book I’m reading, I’m asked to trace a person’s "profile" according to the year she was born (like those Facebook tests) but in order to limit the possibility of what is…
-
2
votes3
answers191
viewsLogical operator || in C# does not work
I’m trying to do an exercise where in a range of 0 to 30 I want to know which numbers are divisible by 3 or 4. Working with a if for every situation works. But if I try to use the logical operator…
-
2
votes2
answers1130
viewsHow to replace 1 bit of an integer without changing the other neighboring bits?
I want to change 1 bit and keep the same values of the other neighboring bits. The bit operator shifts to the left or right by changing the bit of 1 pair 0, but it changes the entire 8-bit sequence.…
-
2
votes2
answers4786
viewshow do I remove some numbers after the comma in PHP
How do I remove some numbers after the comma in PHP? ex: 25.523832732732... Then I want you to stay only 25.52
-
2
votes4
answers258
viewsHow is this operator not working in this code?
Code: var i = 0, finished = false; while( (i < acentos.length) && !finished){ Question: I have a variable bool receiving false, and in my while I am denying her. If I’m denying a false…
javascript operators logic boolean logical-operatorasked 7 years, 4 months ago Nicolas Guilherme Matheus 502 -
2
votes1
answer111
viewsError when performing LINQ query with equals in Where enclosure
When executing the query below: public ActionResult GridViewPartial() { if (Session["cod_cli"] != null) { int cod_cli = Convert.ToInt32(Session["cod_cli"]); //var model = db.DadosTecnicos; var model…
-
2
votes3
answers16313
viewsComparison of char in C
I need to find out if each element of a chained list is a vowel or not. How can I fix my code? int BuscaNv(LISTA* resp){ NO* atual = resp->inicio; while(atual){ if(atual->letra == 'a' || 'e'…
-
2
votes1
answer58
viewsIncrement and decrement do not work in expected order
int main(){ int i=5; printf("%d%d%d%d%d",i++,i--,++i,--i,i); } output: 45555 Why this exit? I did not understand correctly the reason for this exit.…
-
2
votes2
answers133
viewsAny difference between the two expressions?
int p=4,u=12; System.out.println(p=u); System.out.println(p=+u); I don’t understand the difference between the two expressions?
-
2
votes1
answer511
viewslvalue required as left operand of assignment - rest of division
I’m having a problem making rest of the division. Gave that mistake: value required as left operand of assignment How do I fix it? #include <stdio.h> #include <stdlib.h> int main() { int…
-
2
votes1
answer76
viewsWrite member access to a pointer structure instead of using the "->" operator
How would you write this assignment: p1->caracter='B'; otherwise using * instead of ->?
-
2
votes1
answer255
viewsOperator overload in C#
I have some questions about overloading operators in C#. What good is? His concept is the same as Overload in Java methods? Is there any practical example of doing such a procedure on a day-to-day…
-
2
votes1
answer107
viewsPointer arithmetic in C
I am doubtful in a way to know the length of a vector without using sizeof: int n = *(&arr + 1) - arr; It is known that: arr is the type int ( * ) and (&arr + 1) is the type int ( * )[size].…
-
2
votes2
answers383
viewsSubtraction of arrays
I have two arrays: A AND B A = [1,2,3...] B = [7,5,1...] When I do this subtraction has the correct subtraction return: console.log(A[0] - B[0]); But when I play in the loop it doesn’t work: while…
-
2
votes2
answers108
viewsDoes the use of the "alias-assignment" '->' operation interfere with the performance of the application?
In the descending languages of Clipper, there is an operator called "the alias. For example, I can take a field of one result set from that operator (example in ADVPL): cSQL += " SELECT " cSQL += "…
-
2
votes1
answer875
viewsHow to invert a positive number to negative and vice versa in C#?
How do I get the number typed by the user, whether positive or negative, reversed? using System; namespace POOTeste { class Program2 { static int Main(string[] args) { int numero;…
-
2
votes1
answer117
viewsBit-by-bit operations (XOR)
#include <stdio.h> void main(){ int a = 356, b = 3; printf("%d\n", a ^ b); /* system("pause"); } Somebody explain to me why this xor does 359? The conversion to binary gets: 101100100 -->…
-
2
votes1
answer64
viewsHow to declare a boolean Operator()?
I understand what it does and its usefulness, however, during the researches I did found contradictory information regarding the syntax of a boolean operator. I found 2 syntaxes: bool operator()…
-
2
votes1
answer160
viewsHow does operator overload work?
How this code works? class MyClass: def __init__(self, *args): self.Input = args def __add__(self, Other): Output = MyClass() Output.Input = self.Input + Other.Input return Output def __str__(self):…
-
2
votes1
answer670
viewsHow does the module operator work (%)?
I have a question about module operation. Why 10 % 8 returns 2? I couldn’t find it in the documentation.
-
2
votes3
answers70
viewsFirst decrement in Javascript with post-decrement operator ("number-") differs from "number - 1"
It is known that in javascript numero-- subtracts 1 from the value of numero and amounts to: numero = numero-1; So why is there difference in the result in the execution of the two forms? Form 1:…
-
2
votes1
answer900
viewsWhy is the operator "?:" called Elvis Operator?
In PHP, I usually use some expressions to simplify the declaration of a variable conditionally, via the operator ?:. Example: function testing($usuario = null) { $usuario ?: $usuario =…
-
2
votes1
answer78
viewsPost-increment, pre-increment and its precedence
In both cases following the precedence of the above table would look like this: Case 1 int x = 3; int y = ++x * 5 / x-- + --x; Based on the table of precedence the post-anointing would not come…
-
1
votes1
answer72
viewsOR returns unexpected result
I’m performing that function SELECT COUNT(id) FROM `system_stats` WHERE `name` = 1 OR 0 AND `us_id` = 0 It returns me a value equal to 1, but this 1 no, when I run separately this way, it returns me…
-
1
votes1
answer50
viewsMysql - Reading data in a string
There is a Cost Center table called "ccusto", in it, contains Ids ("code" field) that would like to be returned in a SELECT. However, the data needs to be compared to a string with comma separation,…
-
1
votes1
answer681
viewsHow to use ternary operator to determine what to display?
How can I correctly use the Ternary Operator in Javascript. I have the following code: var Requisitar = function(){ setTimeout(function(){ $.ajax({ url: 'https://steamgaug.es/api/v2', // Acesso…
-
1
votes1
answer80
viewsHow to differentiate "001" from "1" in PHP?
If I compare 001 and 1 in PHP, it gives a result that the numbers are identical! Indeed it seems so! How do I differentiate 1 from 001, treat each one as if it were different?
-
1
votes2
answers147
views -
1
votes2
answers823
viewsAdding the column of a PHP table
Good evening, you guys, I bring in a table a result of a select of a bank, but in the result: echo"". $T_TOTAL.""; I’m bringing a variable because I had to do a treatment to get my result. Doubt:…
-
1
votes1
answer69
viewsHow to pass the class (Teste2 teste2) as reference in the ("super") C++ constructor?
On the basis of that reply In C++ what command corresponds to super() of Java? Class Teste2{ int x; int y; public: Teste2(int x, int y){ . . . } } class Testando{ Teste2 *teste2; public:…
-
1
votes1
answer102
viewsA comparison between 2 char(s) is wrong
I’m manipulating a string with a loop for... which generates a new string of the same, starting and ending from a certain position (would be "Hello" in that case). When comparing the return of the…
-
1
votes1
answer112
views -
1
votes1
answer334
viewsOperator & and * in functions
What is the meaning of this & in front of the matrix (my function only works with &, I am overloading Cout<<(matriz1 + matriz2)) And the meaning also of the * in front of the void?!…
-
1
votes2
answers1215
viewsHow to pass arguments by value in Python?
def somentenumeros(entrada): try: int(entrada) return True except: return False while True: cpf = input('Digite seu CPF ou digite os nove primeiros digitos ') if somentenumeros(cpf) == False or…
-
1
votes1
answer468
viewsWhat does it mean to say that an expression is short-circuited?
In the documentation PHP, about operators says: // foo() will never be called because all the expression short circuit. What does it mean to say that all expression is short-circuited? What happens…
-
1
votes1
answer64
viewsDoubt about iteration with multiple parameters
This loop performs Log_base_2 of an integer value, at the end the result is available in the variable i. Why make a shift in the form valor >> 1 has no effect compared to valor = valor…
-
1
votes1
answer4962
viewsLvalue required as left operand of assignment
I get this mistake lvalue required as left operand of assignment in the code if (a*a = b*b + c*c) { printf ("TRIANGULO RETANGULO\n");}…
-
1
votes1
answer118
viewsAttribution operator "=" javascript
I’ll tell you what: var d = new Date(); var dataInicial = new Date(2017, 5, 1); var dataFinal = new Date(2017, 5, 20); var percorreDatas = function(){ d = dataInicial; while(d <= dataFinal){…
-
1
votes1
answer609
viewsWorking with Hexadecimal in Java
I saw an example of code on the Java documentation site on bit that can be checked here. This class belongs to the example cited in link above: class BitDemo { public static void main(String[] args)…
java characteristic-language operators int hexadecimalasked 7 years, 5 months ago Pena Pintada 4,678 -
1
votes0
answers72
viewsHow do you turn a character into a mathematical symbol?
I have a question, can I convert a char or string variable into a mathematical operator? Is it possible? The language I use is Java. For example: int n1 = 1, n2 = 1; char simb = '+'; int resultado =…
-
1
votes2
answers131
viewsConvert power
I have a function format(input) which transforms code citation from a numerical expression, to become more readable to the user with Unicode characters. e. g. "3 * 2 + 1 - 5 / 2pi" -> "3 × 2 + 1…
-
1
votes3
answers187
viewsWhat do these operators " > " and " mean? "
The code below is part of an algorithm that shows the height of a binary tree: int left = height(p->left); int right= height(p->right); int larger = (left > right? left : right); return 1 +…
-
1
votes1
answer102
viewsHow does Python determine if a value is true?
I have the following doubt: >>> a = [200,100] >>> a[True] Exit >>> 100 >>> a = [200,100] >>> a[False] Exit >>> 200 Why does this happen? The…
-
1
votes2
answers75
viewsHow do I define Operator= for a c++ struct?
I have the structure to follow: struct PATH { vector<ARCO_TEMPO> rota; set<int> rotaAux; float COST; int nArcosVoyage; vector<bool> VisitedNodes; vector<vector<bool>>…
-
1
votes1
answer100
viewsProblem to split variables in PHP
I’m having trouble with a php page. Whenever I put the following code to do the division of two variables stored in arrays $dj_cv_at[percentual][$i] = ($dj_cv_at[concluida_c_imp_total][$i] /…
-
1
votes1
answer77
viewsUtility of the coercion operator reinterpret_cast
What is the coercion operator for reinterpret_cast?
-
1
votes3
answers126
viewsFormal definition of operations = and ==
What is the formal definition of the use of = and of == in Python? I can identify in the examples when I have to use which, but when I try to identify these operations by a formal definition as…
-
1
votes1
answer789
viewsThe operator "==" cannot be applied to operators of type "string" and "long"
Hey, good night, man. I’m doing a job for the college in C# and I don’t have much experience. I went to run the program and the error described in the title appeared. The piece of the code is this:…
-
1
votes1
answer51
viewsStyling an element that is not a child of the element used in the selector
I have the code below where I want to, by clicking on the toogle (which is a input[type=checkbox]), another element, which is a class of another div, below, be stylized. In the following code, I…