Program to illustrate pointer arithmetic without increment operator
#include <stdio.h>
void main()
{
int a[5]={10,20,30,40,50};
int *p;
int *q;
p=&a[1];
q=&a[4];
printf("\n value is %d",(*p + *q));
}
output:
Program to illustrate pointer arithmetic with increment operator
#include <stdio.h>
void main()
{
int a[5]={10,20,30,40,50};
int *p;
int *q;
p=&a[1];
q=&a[4];
p++;
printf("\n value is %d",(*p + *q));
q++;
printf("\n value is %d",(*p + *q));
}
output:
#include <stdio.h>
void main()
{
int a[5]={10,20,30,40,50};
int *p;
int *q;
p=&a[1];
q=&a[4];
printf("\n value is %d",(*p + *q));
}
output:
Program to illustrate pointer arithmetic with increment operator
#include <stdio.h>
void main()
{
int a[5]={10,20,30,40,50};
int *p;
int *q;
p=&a[1];
q=&a[4];
p++;
printf("\n value is %d",(*p + *q));
q++;
printf("\n value is %d",(*p + *q));
}
output:
No comments:
Post a Comment