How can i create dynamically allocated array In C [duplicate]

Assuming you have the number of rows “r” and the number of columns “c”, you can do this: int **arr; arr = malloc(r*sizeof(int*)); for(int i=0; i < r; i++) { arr[i] = malloc(c*sizeof(int)); } this dynamically allocates an array of pointers to integers, and then allocates arrays of integers to each pointer. Don’t forget to … Read more

Calling a pointer function in C++

Pointer Declaration General Format: data_type *pointer_name; A pointer declaration such as, int *numberPtr; declares numberPtr as a variable that points to an integer variable. Its content is a memory address. The * indicates that the variable being declared is a pointer variable instead of a normal variable. Consider the following declaration : int *numberPtr, number … Read more