Hey, i am completely new to C programming, learning it for my Uni right now, my C exercise group and me have absolutely no clue, why those warnings are thrown, when compiling the code. Also i dont really get the * and & and what exactly they do in the case. All i know is, that &variable stores the address from the RAM of the variable and that * creates a pointer (what ever that means?) or can somehow read what value at a &variable is...i am confused...here is the code:
Code:
#include <stdio.h>
void f(int *);
void f(int *ptr)
{
int ar[] = { 1, 2, 3, 4 };
*ptr = &ar;
}
int main()
{
int *arr;
f(&arr);
for (int i = 0; i < 4; i++) {
int d = arr[i];
printf("The %d-th element is %d.\n", i, d);
}
return 0; //return Code 0 for all good
}