int *parray;
*parray=&array;
1. parray
is of type int *
and in next line when you dereference it (undefined behaviour as it is uninitialized) becomes type int
to which you try to assign address of array . Just do -
parray=array;
2. And in this line -
printf("%d%d",*(parray[i]*2)); //gave 2 specifiers but pass one argument ??
You use 2 format specifiers but you pass only one argument and that also of wrong type.
When you write parray[i]
it means *(parray+i)
,you don't need to further dereference it using *
, as it already of type int
(and you try to dereference an int
variable).
Just writing this would work-
printf("%d",parray[i]*2);