All of lore.kernel.org
 help / color / mirror / Atom feed
From: canbaby <canbaby@21cn.com>
To: Ronaldo Zacarias Afonso <r_zaca@ig.com.br>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Pointer to int
Date: Thu, 22 Jul 2004 13:21:25 +0800	[thread overview]
Message-ID: <40FF4ED5.4020208@21cn.com> (raw)
In-Reply-To: <20040721_211129_060718.r_zaca@ig.com.br>

Ronaldo Zacarias Afonso wrote:

>  Hello everybody, 
>
>  I'm iniciating in the C programming language and there are some things 
>that I realy need to understand, so the question is: 
>
>  In the code: 
>
>  int i; 
>  struct some_struct *ptr; 
>
>  ptr = &some_other_struct; 
>
>  i = (int) ptr; 
>
>
>  1) Is the last sentence a valid one? 
>  2) If it is, what is realy happening? 
>
>note - It seems very stranger to me. A struct pointer being "transformed" 
>into a int variable. 
>
>  Thanks. 
>
>
>_________________________________________________________________________________
>Quer mais velocidade?
>Só com o acesso Aditivado iG, a velocidade que você quer na hora que você precisa.
>Clique aqui: http://www.acessoaditivado.ig.com.br
>
>  
>
yes,it's a validate one.
now the var i have the the some_other_struct address value,you could 
reconstruct the struct like this:
struct some_struct *newstruct = (struct some_struct *)i;
then freely use the newstruct.
-
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

      parent reply	other threads:[~2004-07-22  5:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-21 21:11 Pointer to int Ronaldo Zacarias Afonso
2004-07-21 23:14 ` Luiz Fernando N. Capitulino
2004-07-22  5:21 ` canbaby [this message]

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=40FF4ED5.4020208@21cn.com \
    --to=canbaby@21cn.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=r_zaca@ig.com.br \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.