- #1
Crystal037
- 167
- 7
- Homework Statement
- I am using unary operator inside while loop to assign values, but it isn't doing doing anything
- Relevant Equations
- None
C:
int a[]={12,34,55,76,89,23};
int n=5;
while(n>1){
a[n]=a[--n];}
for(int i=0;i<6;i++){
printf("%d\t",a[i]);
}
The above code should shift the element values to the right of each array cell, but after running the code it doesn't seem to be doing anything.
Last edited by a moderator: