+ 4
What is the purpose of using increment operator?
I couldnt understand it at the very first glance but i made couple of experiments. The given loop tells that the user will keep putting values untill the number of values wont exceed 5 times. As it exceeds, the loop collapses and the program gets shut off. But Why we are using increment operator? How it is helping the user to keep adding values and defeating the purpose of loop " while " ?
10 ответов
+ 3
Just short hand of a=a+1
+ 2
I don’t understand you. Could you please supply your code?
+ 1
Thansk you all but next time ill be more specific about my point.
+ 1
Just short hand of i = i+1
0
It is a fast way
Do you know the difference between ++a and a++
0
Thansk you all but next time ill be more specific about my point.
- 1
To increase the value of a variable by one
- 2
increament operator is a unary operator used to increase the value of a variable
they are of two
pre-increment : increase value first then execute the statement
ex : ++variable
post-increment : execute the statement first then increase the value
ex : variable ++
this is a part of for loop which is also called upgrade expression
ex
void main()
{
int a=10;
clrscr();
printf(“%d\n”,a++);
printf(“%d\n”,++a);
getch();
}
- 2
What anst
- 4
hello muhhel