In the below program, I am creating a character and float pointer and incrementing the pointer by 1 using the increment operator. After performing the arithmetic operation on pointer I am printing the address which is pointing by pointers.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *pcData = NULL; //pointer to character
float *pfData = NULL; // pointer to float
printf(" Address of character pointer before incrementation = %d\n\n\n", pcData);
printf(" Address of float pointer before incrementation = %d\n\n\n", pfData);
pcData++; //Increment the character pointer by one
pfData++; //Increment the float pointer by one
printf(" Address of character pointer After incrementation = %d\n\n\n", pcData);
printf(" Address of float pointer After incrementation = %d\n\n\n", pfData);
return 0;
}
Output:
Address of character pointer before incrementation = 0
Address of float pointer before incrementation = 0
Address of character pointer After incrementation = 1
In the below program, I am creating a character and float pointer and incrementing the pointer by 1 using the increment operator. After performing the arithmetic operation on pointer I am printing the address which is pointing by pointers.
Output:
Address of character pointer before incrementation = 0
Address of float pointer before incrementation = 0
Address of character pointer After incrementation = 1
Address of float pointer After incrementation = 4
need an explanation for this answer? contact us directly to get an explanation for this answer