+ 1
Is that possible to add pointers to each other?
Pointer
2 Respostas
+ 3
Pravesh Maurya
Yes you can do so I'll tell you the easy way.
int first, second, *p, *q, sum;
printf("Enter two integers to add\n");
scanf("%d%d", &first, &second);
p = &first;//first pointer to store value
q = &second;//second pointer to store value
sum = *p + *q;
printf("Sum of entered numbers = %d\n", sum);
return 0;
+ 1
the first answer is for values they point to, you can also add two pointers to get the sum of their addresses
following on the code above :
printf("%p", (int)p + (int)q) ;