Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > why do the following crash

Reply
Thread Tools

why do the following crash

 
 
parag_paul@hotmail.com
Guest
Posts: n/a
 
      03-31-2008
File1.c

int arr[80];

File2.c

extern int *arr;
int main()
{
arr[1] = 100;
return 0;
}
 
Reply With Quote
 
 
 
 
Philip Potter
Guest
Posts: n/a
 
      03-31-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> File1.c
>
> int arr[80];
>
> File2.c
>
> extern int *arr;
> int main()
> {
> arr[1] = 100;
> return 0;
> }


Did you read the FAQ? You have just asked question 6.1, and if you go to
http://c-faq.com/ you will get your answer.

Philip
 
Reply With Quote
 
 
 
 
Richard
Guest
Posts: n/a
 
      03-31-2008

Philip Potter <(E-Mail Removed)> writes:

> (E-Mail Removed) wrote:
>> File1.c
>>
>> int arr[80];
>>
>> File2.c
>>
>> extern int *arr;
>> int main()
>> {
>> arr[1] = 100;
>> return 0;
>> }

>
> Did you read the FAQ? You have just asked question 6.1, and if you go
> to http://c-faq.com/ you will get your answer.
>
> Philip


Will you be replying to every question here with a pointer to the FAQ?

If so possibly you would like to just automate your replies?

Hint : not every programmer that comes here can memorise the entire FAQ
nor can they always find the necessary section of the FAQ.


 
Reply With Quote
 
Ed Prochak
Guest
Posts: n/a
 
      03-31-2008
On Mar 31, 8:56 am, Richard <(E-Mail Removed)> wrote:
> Philip Potter <(E-Mail Removed)> writes:
> > (E-Mail Removed) wrote:
> >> File1.c

>
> >> int arr[80];

>
> >> File2.c

>
> >> extern int *arr;
> >> int main()
> >> {
> >> arr[1] = 100;
> >> return 0;
> >> }

>
> > Did you read the FAQ? You have just asked question 6.1, and if you go
> > tohttp://c-faq.com/you will get your answer.

>
> > Philip

>
> Will you be replying to every question here with a pointer to the FAQ?


Why shouldn't he, if the question really is a FAQ?

>
> If so possibly you would like to just automate your replies?


Are you offering to do it? While the scope of the problem is more
limited, the problem of interpreting human language automatically
appears to be intractable.
>
> Hint : not every programmer that comes here can memorise the entire FAQ
> nor can they always find the necessary section of the FAQ.


The FAQ is a nice reference. No one is expected to memorize it but it
would do good to read it once in a while. (I think I am due for a
refresher.)
Ed
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      03-31-2008
Ed Prochak <(E-Mail Removed)> writes:

> On Mar 31, 8:56 am, Richard <(E-Mail Removed)> wrote:
>> Philip Potter <(E-Mail Removed)> writes:
>> > (E-Mail Removed) wrote:
>> >> File1.c

>>
>> >> int arr[80];

>>
>> >> File2.c

>>
>> >> extern int *arr;
>> >> int main()
>> >> {
>> >> arr[1] = 100;
>> >> return 0;
>> >> }

>>
>> > Did you read the FAQ? You have just asked question 6.1, and if you go
>> > tohttp://c-faq.com/you will get your answer.

>>
>> > Philip

>>
>> Will you be replying to every question here with a pointer to the FAQ?

>
> Why shouldn't he, if the question really is a FAQ?


No problem if you take the time to answer too IMO.

>
>>
>> If so possibly you would like to just automate your replies?

>
> Are you offering to do it? While the scope of the problem is more
> limited, the problem of interpreting human language automatically
> appears to be intractable.


I agree.

But a naive solution would be simply auto reply to each new post

"have you read the FAQ : here ..."

>>
>> Hint : not every programmer that comes here can memorise the entire FAQ
>> nor can they always find the necessary section of the FAQ.

>
> The FAQ is a nice reference. No one is expected to memorize it but it
> would do good to read it once in a while. (I think I am due for a
> refresher.)
> Ed


Off you go then. No one is stopping you. I have too. It doesn't mean I
dont find it easier and more social to ask a human being.

In your haste you seem to have misunderstood. My point is that 99.99% of
questions here are answered in one way or other by the FAQ,

Simply questioning people as to whether they read it and then somewhat
pompously pointing them there makes the group pretty much redundant.

By ALL means post a link to the FAQ, but add some personal explanation
too.

 
Reply With Quote
 
Morris Dovey
Guest
Posts: n/a
 
      03-31-2008
Richard wrote:

> Will you be replying to every question here with a pointer to the FAQ?
>
> If so possibly you would like to just automate your replies?


Richard, I think you just had a great idea!

> Hint : not every programmer that comes here can memorise the entire FAQ
> nor can they always find the necessary section of the FAQ.


That's true. Lacking automated response software, it's good to
have folks like Philip around to help people find ready-made,
accurate answers.

About your automated response idea - care to take a try at it? It
could be an interesting project!

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto/
 
Reply With Quote
 
Noob
Guest
Posts: n/a
 
      03-31-2008
parag_paul wrote:

> File1.c
>
> int arr[80];
>
> File2.c
>
> extern int *arr;
> int main()
> {
> arr[1] = 100;
> return 0;
> }


cf. http://c-faq.com/aryptr/aryptr1.html
 
Reply With Quote
 
Willem
Guest
Posts: n/a
 
      03-31-2008
Richard wrote:
) But a naive solution would be simply auto reply to each new post
)
) "have you read the FAQ : here ..."

He pointed to a *specific item* in the FAQ.

) In your haste you seem to have misunderstood. My point is that 99.99% of
) questions here are answered in one way or other by the FAQ,
)
) Simply questioning people as to whether they read it and then somewhat
) pompously pointing them there makes the group pretty much redundant.

He pointed to the *specific part* of the FAQ that answered the question.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
Reply With Quote
 
Kenny McCormack
Guest
Posts: n/a
 
      03-31-2008
In article <(E-Mail Removed)>,
Willem <(E-Mail Removed)> wrote:
>Richard wrote:
>) But a naive solution would be simply auto reply to each new post
>)
>) "have you read the FAQ : here ..."
>
>He pointed to a *specific item* in the FAQ.


Yes. We all understand that.

>) In your haste you seem to have misunderstood. My point is that 99.99% of
>) questions here are answered in one way or other by the FAQ,
>)
>) Simply questioning people as to whether they read it and then somewhat
>) pompously pointing them there makes the group pretty much redundant.
>
>He pointed to the *specific part* of the FAQ that answered the question.


Yes. We all understand that.

And, yes, all also understand that that is the part that would be a
little tricky about implementing the auto-responder. Save that for
Version 2.0.

In the meantime, an auto-responder that simply greets every new thread
(by a newbie - the program would keep a list of people to exclude from
treatment) with "The answer is in the FAQ. Please see the FAQ at: <URL>"
would be very nice and save certain people (e.g., Bwian) from having to
do it manually.

 
Reply With Quote
 
Bartc
Guest
Posts: n/a
 
      03-31-2008

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> File1.c
>
> int arr[80];
>
> File2.c
>
> extern int *arr;
> int main()
> {
> arr[1] = 100;
> return 0;
> }


The declarations for the arr variable don't match.

Try extern int arr[80] in File2.c.

(I know arrays and pointers are /supposed/ to be interchangeable. But there
is a subtle difference between: int a[80] and int *a)

--
Bart



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/822319ev1'. 'HTTP/1.1 500 Internal Server Error'. chanmm ASP .Net 2 09-07-2010 07:37 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
RE: The Web server reported the following error when attempting to create or open the Web project located at the following URL: <URL> =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?= ASP .Net 0 06-07-2004 07:36 AM
CRASH - DirectX End-User runtime - CRASH - What to to ? reply@newsgroup.please Computer Support 1 01-05-2004 02:55 PM



Advertisments