K
K
kate2018-08-16 01:56:33
C++ / C#
kate, 2018-08-16 01:56:33

What are these symbols?

printf("%d ", i < n/2 ? a[i+n/2] : a[i-n/2]);
Have you ever come across something like this? :
Surely they have some kind of separate name, otherwise I don’t understand what and how at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2018-08-16
@kkate4ka

This is a condition described using ternary operators.
The format is Condition ? Command_if_true : Command_if_false
in your case, if i < n/2, then output a[i+n/2], otherwise a[in/2]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question