Logical problem in programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Logical problem in programming

sen[i++] = ' '; May i ask the logic concept of c programming? if current i = 3; then the above coding should be sen[3] = ' '; or sen[4] = ' ' ?

4th Oct 2017, 3:25 PM
THEE LIFANG
THEE LIFANG - avatar
2 Answers
+ 12
Let's look at this example. int x[] = {1,2,3,4,5}; int i = 0; int j = 0; cout << x[i++] << endl; // x[0] and then i = 1 cout << x[++j] << endl; // j = 1 and then x[1]
4th Oct 2017, 3:37 PM
Babak
Babak - avatar
+ 2
Thank you for your explaination. It's clear to me now.
4th Oct 2017, 3:51 PM
THEE LIFANG
THEE LIFANG - avatar