I'm new to c and not really familiar with pointers or how this method is setup to be called in main with these arguments. I have a bit of an understanding of pointer snow, but i'm still confused with one being in the method arguments. Do I pass in a pointer and an int? Do I need to pass in anything at all? Do I even need the main method or can I just run the program with is_little_endian as my main method?
#include "test_endian.h"
#include <stdio.h>
int is_little_endian(void (*store)(int*,int)) {
int x;
unsigned char *byte_ptr = (unsigned char*)(&x);
store(&x, 1);
printf("the address for x is %u\n", *byte_ptr);
return 0;
}
int main() {
}