Re: Function pointers
saravanaraj v <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
[root@build ~]# cdecl
Type `help' or `?' for help
cdecl> explain char (*pa())[4];
declare pa as function returning pointer to array 4 of char
cdecl> explain char (*p)[4]
declare p as pointer to array 4 of char
cdecl>
Try the following code.
#include <stdio.h>
char (*pa())[4];
int main(){
char(*p)[4]=pa();
/*printf("%d",**p);*/
printf("%d %d %d %d\n",(*p)[0],(*p)[1],(*p)[2],(*p)[3]);
return 0;
}
char (*pa())[4]{
static char arr[]={'\11','\12','\13','\14'};
return &arr;
}
On Thu, Jan 21, 2010 at 12:03 PM, kumar11 <[email protected]> wrote:
>
> Could you please explain the meaning of below declaration statement.
>
> char (*pa())[4];
>
>
> Please find the entire code below.
>
> char (*pa())[4];
> void main(){
> char(*p)[4]=pa();
> printf("%d",**p);
> }
> char (*pa())[4]{
> static char arr[]={'\11','\12','\13','\14'};
> return &arr;
> }
> --
> View this message in context: http://old.nabble.com/Function-pointers-tp27253432p27253432.html
> Sent from the linux-c-programming mailing list archive at Nabble.com.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html