linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: saravanaraj v <saravanaraj.v@gmail.com>
To: kumar11 <ravikumar.chakram@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Function pointers
Date: Thu, 21 Jan 2010 12:27:40 +0530	[thread overview]
Message-ID: <2e0180191001202257j7d41f51cw86484aad228ff729@mail.gmail.com> (raw)
In-Reply-To: <27253432.post@talk.nabble.com>

[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 <ravikumar.chakram@gmail.com> 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 majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-01-21  6:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21  6:33 Function pointers kumar11
2010-01-21  6:57 ` saravanaraj v [this message]
2010-01-21  9:56 ` Glynn Clements
2010-01-23 22:27   ` Milind A Choudhary
     [not found]     ` <201001241003091879376@gmail.com>
2010-01-24  7:59       ` Re: " Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e0180191001202257j7d41f51cw86484aad228ff729@mail.gmail.com \
    --to=saravanaraj.v@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=ravikumar.chakram@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).