Good evening, quick question regarding the following code:
// Start of main
int i,j;
int row,col;
printf("Enter the values for row and col:\n");
scanf("%d%d",&row,&col);
int **arr=(int**)malloc(row*(sizeof(int*)));
for(i=0; i<row; i++)
{
*(arr+i) = (int*)malloc(sizeof(int)*col);
}
// .. code after this snippet
Why am I able to use the variable arr
as a pointer to a pointer and then re-use it as a pointer inside the for loop ?? Why do I not have to create two seperate variables ?