The program prints the start and end pointers of an array. Then it is asked to print the difference which is supposed to be the number of elements as both are pointers of type (int*) and shall return the number of elements 5 (gcc on my local linux) and not the number of bytes 20 (codecast terminal output).
`
#include <stdio.h>
int main(void){
//! showMemory(start=65530)
int arr[6]={10, 20, 30, 40, 50, 60};
int * startPtr = arr;
int * endPtr = &arr[5];
printf("%p %p\n", startPtr, endPtr);
printf("%td\n",(endPtr-startPtr));
return 0;
}
`
The program prints the start and end pointers of an array. Then it is asked to print the difference which is supposed to be the number of elements as both are pointers of type (int*) and shall return the number of elements 5 (gcc on my local linux) and not the number of bytes 20 (codecast terminal output).
`
#include <stdio.h>
int main(void){
//! showMemory(start=65530)
int arr[6]={10, 20, 30, 40, 50, 60};
int * startPtr = arr;
int * endPtr = &arr[5];
}
`