[NTLUG:Discuss] OT C question

Fred James fredjame at fredjame.cnc.net
Tue Sep 27 21:22:16 CDT 2005


Chris Cox wrote:

>Fred James wrote:
>  
>
>>All
>>My brain must be fried, but I just don't see why this
>>
>>/*   foo.c   */
>>#include <stdio.h>
>>int main(int argc, char *argv) {
>>    
>>
>
>How about:
>
>int main(int argc, char* argv[]) {
>
>  
>
>>       printf("%d\n", argc);
>>       printf("%s\n", argv[1]);
>>       return (0);
>>}
>>
>>should result in this
>>
>>#> ./foo one
>>2
>>Memory fault(coredump)
>>#>
>>
>>Thank you in advance for any help you may be able to offer
>>Regards
>>
>>    
>>
Chris Cox
Thank you - that was indeed my bad.  The results are good with either 
"char* argv[]" or "char *argv[]"
Regards
Fred James




More information about the Discuss mailing list