//#if 0

#include <stdio.h>
int main()
{
    const char *s = "geeksquizahhdcha";
    printf("%lu", sizeof(s));
    printf("\n%c", s[1]);
    return 0;
}
//output only 8 because of 64 bit pointer 8 fixed
//#endif

#if 0
#include <stdio.h>
int main()
{
    char s[] = "geeksquizhf";
    printf("%lu", sizeof(s));
    s[0] = 'j';
    printf("\n%s", s);
    return 0;
}//output 12 , jeeksquizhf
#endif

Below are the key differences:

https://[Log in to view URL]

int (*ptr) [3] declares ptr to be a pointer to an array of 3 ints.
There are two common ways to figure this out.

By order of operations. The parentheses make the "*" bind tightest to "ptr",
so "ptr" is a pointer, then after that is the "[3]" which means array of 3,
then finally "int", which means integer. So ptr is a pointer to an array of 3 ints.

Types in C generally "look like" how you could use them. So for example, 
int (*ptr) [3] means you can dereference "ptr", index it, and get an int,
so "ptr" must be a pointer to an array of 3 ints. (This is not completely true;
if "ptr" were a pointer to pointer, you could also dereference it and then index it.
However, when you use this exercise to interpret types,
assume only arrays are indexed, and only pointers are dereferenced.)

void (*p[2])(int*, int); declares "p" to be an array of 2 pointers each to
a function that takes (int*, int) parameters and does not return anything.

Using the methods I explained above:

By order of operations. Array indexing ("[]") has higher precedence than 
dereferencing ("*"), so it's immediately an array, then you see "*", 
so it's an array of pointers, then you see the function call,
which means that these pointers are function pointers,
that point to a function with the given signature.

By looking like how it could be used: You subscript "p", then dereference it,
and then call that as a function that takes (int*, int), and that results in 
"void". Thus, "p" must be an array of pointers to functions that take (int*, int)
and return nothing.



What is the difference between char *p [] and char (*p) [] in c?

char *p[] ; Array of Pointers

We can declare an array that contains pointers as its elements. Every element of this array is a pointer variable that can hold address of any variable of appropriate type.

The syntax of declaring an array of pointers is :

datatype *arrayname[size];

For example, to declare an array of size 10 that contains integer pointer we can write -

int *arrp[10];

/* Program : Array of pointers */

#include<stdio.h>

int main(void)

{

int *pa[3];

int i, a=5, b=10, c=15;

pa[0] = &a;

pa[0] = &b;

pa[0] = &c;

for(i=0; i<3; i++)

{

printf("pa[%d] = %p\t", i , pa[i]);

printf("*pa[%d] = %d\n", i , *pa[i]);

}

return 0;

}

Its output :

pa[0] = 0012FEC0 *pa[0]=5

pa[1] = 0012FEC4 *pa[1]=10

pa[2] = 0012FEC8 *pa[2]=15

Case II

char (*p)[] ; Pointer to an Array

Here p is a pointer to an array of characters.

Here I am considering data type as int.

To understand the difference between pointer to an integer & pointer to an array of integers :

int *p; /* Can point to an integer */

int (*ptr)[5]; /* Can point to an array of 5 integers */

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: