Questions tagged [operands]

Operands are values acted upon by an operator, method, or other functional entity.

Operands differ from parameters in that they are the real values used or altered by a function, while the parameters are the named, abstract inputs used to define the function.

313 questions
8
votes
4 answers

Multiplying char and int together in C

Today I found the following: #include int main(){ char x = 255; int z = ((int)x)*2; printf("%d\n", z); //prints -2 return 0; } So basically I'm getting an overflow because the size limit is determined by the operands on the right side…
Martin Konecny
  • 57,827
  • 19
  • 139
  • 159
7
votes
2 answers

How to solve && operands to logical scalar

After I run the code in matlab, I encounter this error and unsure how to solve it. How can I solve this problem. Warning: Operands to the || and && operators must be convertible to logical scalar values. Jgray = double(rgb2gray(J)); %…
Kim
  • 347
  • 2
  • 7
  • 18
7
votes
3 answers

Help with mathematic operands in class (c#)

public class Racional { private T nominator; private T denominator; public T Nominator { get { return nominator; } set { nominator = value; } } public T Denominator { get { return denominator;…
user707895
  • 351
  • 1
  • 4
  • 15
7
votes
3 answers

What does "unsupported operand type(s) for -: 'int' and 'tuple'" means?

I got a error saying: unsupported operand type(s) for -: 'int' and 'tuple' How do I correct it? from scipy import integrate cpbar = lambda T: (3.826 - (3.979e-3)*T + 24.558e-6*T**2 - 22.733e-9*T**3 + 6.963e-12*T**4)*8.314 deltahbarCH4 =…
hetapuru
  • 85
  • 1
  • 1
  • 4
6
votes
1 answer

Difference between & and && in Scala?

I am trying to figure out the difference between & and && in Scala. I got this after searching & <-- verifies both operands && <-- stops evaluating if the first operand evaluates to false since the result will be false Can somebody explain the…
NeoWelkin
  • 332
  • 1
  • 3
  • 12
6
votes
1 answer

unsupported operand type(s) for -: 'str' and 'datetime.datetime'

I'm trying to write a Python script to count down to my next birthday. Unfortunately, I keep getting this error message stating unsupported operand type(s) for -: 'str' and 'datetime.datetime' Any help would be appreciated. Here's my code: import…
Kenneth Ogden
  • 61
  • 1
  • 1
  • 2
5
votes
4 answers

Invalid Operands to binary / (have 'int *' and 'int')?

Every time I try this: long crypt(int *integer) { printf("Enter five digit integer:\n"); scanf("%i",integer); int digit1=integer/10000; int digit2=(integer%10000)/1000; int digit3=(integer%1000)/100; int…
lakam99
  • 575
  • 4
  • 9
  • 24
5
votes
1 answer

Contradiction about Order of Evaluation of operands

When I study recursive functions in C from deitel c, I read this sentence: Standard C does not specify the order in which the operands of most operators (including +) are to be evaluated. But also the book says that: associativity of '+' from…
5
votes
3 answers

Operator '!' cannot be applied to operand of type x

So I have some code in VB that I am trying to convert to C#. This code was written by someone else and I am trying to understand it but with some difficulty. I have some bitwise operator and enum comparison to do but keep throwing an error out: I…
Mo Patel
  • 2,321
  • 4
  • 22
  • 37
5
votes
2 answers

postfix (prefix) increment, L-value and R-value (in C and C++)

I just learned the following facts: The result of a prefix increment (++var_name) is an R-value in C (at least, I am sure that it is not a L-value in C), but it is an L-value in C++. The result of a postfix increment (var_name++) is an R-value…
user565739
  • 1,302
  • 4
  • 23
  • 46
4
votes
3 answers

Dividing by zero in C

When I compile the program: #include int main(void) { int x, y = 0; x = 1 / y; printf("x = %d\n", x); return 0; } It gives "Floating point exception (core dumped)" However, when I compile: #include int…
Evan Waddicor
  • 101
  • 1
  • 4
4
votes
1 answer

How to use RE OR Operand for Pandas RE .str.extract()

I'm a newbie and sure this is something silly in my code. In my defense I've tried re-reading through the Python RE documentation here before asking and searching around but don't see a duplicate question so far (which surprised me.) Outside of a…
Programming_Learner_DK
  • 1,509
  • 4
  • 23
  • 49
3
votes
5 answers

why choose one's complement when writing to a register

What are the benefits of, for example writing the first statement vs second statement: First statement: ANCON1 = ~0x0C; Second statement: ANCON1 = 0xF3; I'm seeing the second as a clear choice I would have made, cause it's more straight forward…
Christian
  • 1,548
  • 2
  • 15
  • 26
3
votes
1 answer

MATLAB logical operators: && vs &

If I want to ensure that an if statement only executes if BOTH of two conditions are true, should I be using & or && between the clauses of the statement? For example, should I use if a == 5 & b == 4 or if a == 5 && b == 4 I understand that the…
CaptainProg
  • 5,610
  • 23
  • 71
  • 116
3
votes
1 answer

Force compiler to use memory operand from Intrinsics

Is there exist a syntax to force C compiler to use memory operand directly ? In the good old asm time we simply write in the instruction where to take operand - 'real' register or memory pointer (location pointed by address). But in the intrinsics…
DTL2020
  • 71
  • 3
1
2
3
20 21