I am badely confused how pointer to struct pass to function including dynamic memory allocation in function
This is my program and I intentionally didn't created structured member and written function. I want some experience persome to create structured and function need to test two lines written releated function in main function.
.
I know pointer, function, dynamic memory allocation, and structure. I am having hard time understanding how to pass pointer to struct to function.
This is my program and I intentionally didn't created structured member and written function. I want some experience persome to create structured and function need to test two lines written releated function in main function.
C:
#include<stdio.h>
#include<stdlib.h>
struct point
{
};
int main ()
{
struct point *P = NULL;
fun1(P); // passing pointer to structure by value
fun2(&P); // passing pointer to structure by address
return 0;
}
I know pointer, function, dynamic memory allocation, and structure. I am having hard time understanding how to pass pointer to struct to function.