>>108582475
This code compiles, but gives the following warning:
test.c: In function ‘f’:
test.c:4:26: warning: ‘sizeof’ on array function parameter ‘a’ will return size of ‘int *’ [-Wsizeof-array-argument]
4 | size_t s = sizeof(a);
| ^
test.c:3:12: note: declared here
3 | void f(int a[], char *id) {
| ~~~~^~~
And when I try to run it I get a segmentation fault.
I don't understand what are you trying to accomplish, you're declaring a variable s in f, but this variable is popped from the stack when the function exits so f(arr1, "arr1") should do nothing, and p() is trying to print the uninitialized pointer *id, so it gets a segfault because it's trying to access a pointer with a garbage address that probably points outside the program.
>>108582516
So what is best practice? For example, If I have a string, should I declare it as a pointer or an array?
char s[] = "Hello World";
char* s = "Hello World";
Is there any practical difference?