Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

what is a+j

note: I change i to j because i is italic in ee

#include <stdio.h>
#include <string.h>

main()
{
//int A[];
int A[]={2,4,5,8,1};
printf("%d\n",A);
printf("%d\n",&A[0]);
printf("%d\n",A[0]);
printf("%d\n",*A);
//int *p = A;
int j;
for(j = 0;j<5;j++)
{
    printf("variable a[j]: address=%d value=%d\n",&A[j],A[j]);
    //printf("variable a:::: address=%d value=%d\n",&A,*A);
    printf("variable a+j:: address=%d value=%d\n",&A+j,*(A+j));
}
}

Open in new window



output
-1524265408
-1524265408
2
2
variable a[j]: address=-1524265408 value=2
variable a+j:: address=-1524265408 value=2
variable a[j]: address=-1524265404 value=4
variable a+j:: address=-1524265388 value=4
variable a[j]: address=-1524265400 value=5
variable a+j:: address=-1524265368 value=5
variable a[j]: address=-1524265396 value=8
variable a+j:: address=-1524265348 value=8
variable a[j]: address=-1524265392 value=1
variable a+j:: address=-1524265328 value=1

Open in new window


User generated image

address =&A[j] = (A+j)
value= A[j] = *(A+j)


what is A+J
SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

If you add 1 to any of the pointers F, I, or C, the result will be the next float, int, or character.
could you give example please

(A+j) == &(A[j]) == &(j[A])
i do not understand  &(j[A])
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did someone claim that it was?
Avatar of rgb192

ASKER

&(j[A])  == &(A[j])
(A+j) == (j+A)

what is j[A]

is j an array or list?
is A an array or list?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

Thanks.

i did not fully understand your answers so just need to trust and move on to a debugger local window which is my next question

https://www.experts-exchange.com/questions/28499114/modify-code-so-I-can-see-values-in-a-local-debugger-window.html
Avatar of phoffric
phoffric

>> j[A] is A[j]
It is rare to see j[A]. A[j] is the norm.