Ptr
Ptr2ptr
Void ptr
Fn ptr
Void ptr fn (not like void ptr)
Pointer to an array
Array of ptrs
Int *p;
There will be a memory space reserved for 2 bytes which can store address of integer type.
&p represents address of the pointer variable. Mostly we won’t use this..
P = &somevariable
That Is P will gives the address of the variable it points to.
*p= some value , will make somevariable to assign some value.
We can have **p ,***p,****p so on…
Always p can hold some address of int type…
Int in int *p implies the somwvariable value is of int type…
Char in char *p implies somevariable value is of char type…
Void in void *p implies the somevariable can be of any type.. it is known only at run time…
We can also have pointer functions…
Consider a function int p(int a) that returns ‘a’ value
Int (*ptf) (int) = &p; // the braces are mandatory…
also we can call like ptf = p;
We can invoke the function by 2 way..
P(2);
(*ptf) (2);
Both will return 2 as output.
these thing will work fine in laptop memory
sample program
# include
# include
void func1(int (*a)[10][10])
{
printf("%d ",a);
}
void func2(int a[][][])
{
printf("%d",a);
}
int main()
{
int a[10][10][10],b[10];
printf("%d ",a);
func1(a);
func2(a);
getch();
return 0;
}