Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
705 views

I do not understand how {int a=10; a+=++a-5/3+6*a; System.out.print(a);} outputs 86

I do not understand how { int a = 10; a += ++a-5/3+6*a; System.out.print(a); } outputs 86 I know that shorthand notation has lower precedence than any of the operator used here so my ...
Vyagh's user avatar
  • 11
0 votes
0 answers
53 views

How does printf() execute its arguments with prefix and postfix unary operators?

I wrote a simple code for printf in C with unary prefix operator as the following: #include <stdio.h> int main() { int i=5; printf("%d %d %d",++i,i,i+1); return 0; } And ...
Viraj's user avatar
  • 1
0 votes
1 answer
258 views

Is it okay to use python operators for tensorflow tensors?

TL;DR Is (a and b) equivalent to tf.logical_and(a, b) in terms of optimization and performance? (a and b are tensorflow tensors) Details: I use python with tensorflow. My first priority is to make the ...
Daniel S.'s user avatar
  • 6,680
0 votes
2 answers
105 views

Renaming multiple subdirectories with the name of parent directory as prefix

I have multiple directories 1111, 2222, 3333, 4444 and inside each directory is subdirectory named as for example _apple. I want to add the parent folder name as prefix to the sub directory. What I ...
Nayab Qureshi's user avatar
2 votes
1 answer
81 views

JavaScript Operator Precedence, Assignment, and Increment?

In JavaScript (JS), ++ has higher precedence than += or =. In trying to better understand operator execution order in JS, I'm hoping to see why the following code snippet results in 30 being printed? ...
mishar's user avatar
  • 455
0 votes
3 answers
87 views

StackOverFlow in Postfix Decrement in JAVA

This works fine because we are using the prefix decrement operator in the recursive call ! public static void main(String[] args) { doubt1(5); } Prefix Decrement: static void doubt(int num) { ...
Tholkappiar's user avatar
-1 votes
1 answer
52 views

Prefix and postfix operator

#include <stdio.h> int main() { int x=5, y; y=x+++x; printf("%d", x); printf("%d", y); } What I found is that postfix increment has higher precedence than ...
Subham Bhuyan's user avatar
0 votes
0 answers
20 views

Precedency of Postfix and prefix operator in C [duplicate]

I am finding difficulty to understand how precedency works in the following case. Can anyone explain why the answer is different in below two printf functions? int main() { int a=10,b=20,c; c=...
Kamlesh Makvana's user avatar
1 vote
1 answer
165 views

precedence operator in java 8 - postfix operator first

Following the precedence operator in java 8 it is clear that the postfix operator (expr++ expr--) has a higher precedence that the unary operator, pre-unary operator (++expr --expr). However when ...
jav's user avatar
  • 13
2 votes
2 answers
157 views

c++ expression value (operator precedence)

The following expression :- int main() { int x=2, y=9; cout << ( 1 ? ++x, ++y : --x, --y); } gives the following output:- 9 As per my understanding, it should return ++y which should ...
schwillr's user avatar
-3 votes
3 answers
112 views

Different and odd results when using prefix and postfix operators in function arguments [duplicate]

Code: #include <stdio.h> int main() { int i = 3; printf("%d %d %d %d %d\n",i = 7,--i,i = 18, i+5, i = 0); printf("%d %d %d %d %d\n",i = 7,i--,i = 18, i+5, i = 0);...
Vishesh Mehta's user avatar
0 votes
1 answer
111 views

Prefix operators are not working as expected in C [duplicate]

#include <stdio.h> int main() { int a = 1; int b = 1; int c = a || --b; int d = a-- && --b; printf("a=%d, b= %d, c= %d, d= %d",a,b,c,d); return 0; } In ...
prithvi2k2's user avatar
1 vote
1 answer
860 views

Prefix notation string calculator Javascript problem

I'm making a calculator for a prefix notation string and it has covered all the normal tests that I've added to it. But I've come across one that it doesn't seem to be getting the right answer for and ...
4156's user avatar
  • 400
-2 votes
3 answers
125 views

Pre and Postfix Increment

a = 1; int a2 = a++; System.out.println("----------Test 3 ----------"); System.out.println("The value of a is " + a); System.out.println("The value of a2 is " + a2); ...
Emily Watson's user avatar
1 vote
1 answer
204 views

Using postfix/prefix increment operators in compound literals in C99

There is an example borrowed from CARM (C A Reference Manual, Samuel P. Harbison III, Guy L. Steele Jr., 2002, Prentice Hall), page 218-219. I write all of three code-chunk in one source: #include <...
Andrey Lanin's user avatar

15 30 50 per page
1
2 3 4 5
7