Agus Budy Wuysang wrote:
>
> int main(int c) { return 0; }
>
> int main(int c, char * const s[]) { return 0; }
>
> int main (int c, char * const s[], char * const e[]) { return 0; }
>
> c = total argument
> v = pointer ke semua "constant string" argument arg[0] ,.. arg[argc - 1]
> e = pointer ke semua "constant string" environment
> (const) string = (const) array of char
>
> nama identifier (c, v, e) bebas, yang penting type & urutannya segitu..
>
mmm, itu "constant string" apa maksudnya bukan 'const char *s[]' dan
'const char *e[]' ? Dan kalau nggak salah, argv[argc+1] itu selalu
diberi nilai NULL, jadi kita bisa nulis seperti ini:
int main(int argc, const char *argv[])
{
printf("program=%s\n", *argv);
while (*++argv)
printf("argument=%s\n", *argv);
return 0;
}
cheers,
Bennylp
--------------------------------------------------------------------------------
Utk berhenti langganan, kirim email ke [EMAIL PROTECTED]
Informasi arsip di http://www.linux.or.id/milis.php3
Pengelola dapat dihubungi lewat [EMAIL PROTECTED]
- [programming] Command Line Argument for C Danny Setiawan
- Re: [programming] Command Line Argument for C nasirs
- Re: [programming] Command Line Argument for... Haris Fauzi
- RE: [programming] Command Line Argument for C commedo
- Re: [programming] Command Line Argument for C Hardian Suprapto
- Re: [programming] Command Line Argument for C Agus Budy Wuysang
- Re: [programming] Command Line Argument for C Priyadi Iman Nurcahyo
- Re: [programming] Command Line Argument for C Benny Prijono
- Re: [programming] Command Line Argument for C Danny Setiawan
- Re: [programming] Command Line Argument for C Agus Budy Wuysang
- RE: [programming] Command Line Argument for C Purwadi
- Re: [programming] Command Line Argument for C Benny Prijono
- Re: [programming] Command Line Argument for... Agus Budy Wuysang
- Re: [programming] Command Line Argument for C Agus Budy Wuysang
- Re: [programming] Command Line Argument for C Benny Prijono
- Re: [programming] Command Line Argument for C Agus Budy Wuysang
- Re: [programming] Command Line Argument for... Benny Prijono
