linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Michael Khu <ronkhu@ntsp.nec.co.jp>
Cc: Fabio <fabio@crearium.com>, linux-c-programming@vger.kernel.org
Subject: Re: Dinamic array allocation
Date: Tue, 26 Oct 2004 12:12:28 +0800	[thread overview]
Message-ID: <417DCEAC.2000408@hq.ntsp.nec.co.jp> (raw)
In-Reply-To: <417DCDE9.8000004@hq.ntsp.nec.co.jp>

oops.. i meant argv[1] not arvp[1]

sorry.

ex:
malloc( atoi( argv[1] ) + strlen( foo) );

Ron Michael Khu wrote:

> arvp[1] is string....
> u should convert it to a numeric type via atoi() or strtol()....
>
> =)
>
> Fabio wrote:
>
>> Hi.
>>
>> I am programming a C code that gets argv[1] as the lenght of an array 
>> that is the copy of an array plus more data.
>>
>> So, the appication runs as: ./a.out 100
>>
>> It create an array of 100 bytes and adds a static defined array plus 
>> more data, like:
>>
>> char *foo[5]="bar"
>> main(int argc, char *argv[])
>> {
>>    char *Ptr[];
>>    Ptr = malloc( argv[1]+strlen(foo));
>>    ....
>> }
>>
>> Makes sense? guess no.
>>
>> Any suggestion is welcome.
>>
>> thanks in advance
>> -
>> 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:[~2004-10-26  4:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-26  3:03 Dinamic array allocation Fabio
2004-10-26  4:09 ` Ron Michael Khu
2004-10-26  4:12   ` Ron Michael Khu [this message]
2004-10-26  4:59   ` Lejanson C. Go
2004-10-26  5:15     ` Ron Michael Khu
2004-10-26  5:51 ` 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=417DCEAC.2000408@hq.ntsp.nec.co.jp \
    --to=ronkhu@ntsp.nec.co.jp \
    --cc=fabio@crearium.com \
    --cc=linux-c-programming@vger.kernel.org \
    /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).