PLEASE HELP ME ! PLEASE

M

Mark McIntyre

I frequently do and have done so.

There's no evidence to that effect, though I'm happy to belive it.
But the pollution level in this NG is second to none.

Mainly, of late, because /you/ insist on posting time after time
complaining about everyone else. Perhaps you should take your own
advice and shut the .... up?
Killfile me for all I care. I really don't mind.
I would also suggest you add posters whose net nanny to help ratio is
more than 1:1.

Like, eg, yourself. Work it out, einstein.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre

Martin Ambuhl said:
Guru said:
a^=b^=a; // could be still better than 3 statements.

No, it is horrid. The OP poster asked about swapping two number
[sic]. The '^' operator requires operands of an integer type. And

Don't be so ridiculous.

Did you bother to read the FAQ?
Students who come here asking these type of questions are rarely in the
position to slap their lecturers.

Nobody suggested he should slap his lecturer. Are you confusing this
with a differnt thread?

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
D

Default User

Mark said:
This has been tried in the past, many times, and found disastrous.

You'll notice also that Richard doesn't seem to find his own advice
very compelling.




Brian
 
D

Default User

Christopher said:
After that post, and given that "Umesh" is posting from an e-mail
address called "fraternitydisposal", I find it less credible that the
entity is not a troll.


Troll or unredeemably clueless. I killfiled him long ago.




Brian
 
C

Christopher Benson-Manica

Martin Ambuhl said:
Is this Richard just incredibly stupid or is he a troll?

He seems to be a somewhat more acerbic version of E. Robert Tisdale.
 
K

Keith Thompson

Chris Hills said:
The whole point of this code is that if the student uses it without
understanding it they will get spotted as a CHEAT
[...]

Do you seriously believe that Umesh knows enough to post deliberately
bad code in an attempt to trip up someone asking for us to do his
homework?

Take a look at his posting history. Either he's a deliberate troll,
or he persists in using void main() and #include"stdio.h" because he
doesn't know any better, despite the fact that he's been told
repeatedly that they're wrong, and why they're wrong, and how to
correct them.

If you haven't been paying close attention (you're certainly not
required to), or if you've already killfiled Umesh and didn't notice
his name in the attribution line, then your misunderstanding is quite
understandable; the code is bad enough that parody is a plausible
explanation for it.
 
K

Keith Thompson

Why not create a NG comp.lang.c.homework?

Because it wouldn't work. The people who write the DO MY HOMEWORK
posts aren't going to expend the effort required to find such a
newsgroup, even if it were created.
We can point the posters to
this newsgroups (and hopefully get rid of them) and maybe some of them
will post there directly, and people who like to show off can post
solutions in there. The best would be that those "students" start
helping each other out (I know, the chance of this happening are
almost NULL).

So students who *correctly* ask for help, by showing what they've
already done and asking specific questions about where it's going
wrong, can get incompetent help. I don't think that would be an
improvement.
 
J

Jinsere

It is your own homework.Please do it yourself,or you will never make
progress.Trust yourself,please.
 
C

Clever Monkey

Richard said:
Is this a new record?

14 posts.

9 of them are discourteous warnings about posting style, homework and
things being off topic.

And at least one is a complaint about the rest. Your point?

People have been schooling newbies on USENET etiquette since the dawn of
time, and I find the examples here pretty tame.

Do My Homework For Me queries get what they deserve, however.
 
C

Clever Monkey

Richard said:
The why dont "we" agree that only ONE reply is enough. Why is there the
constant feeding frenzy. Leave it alone to see if someone else replies
or ignore it.
Ok, we nominate you the person to reply to homework questions! Oh, wait.

Dude, USENET is a public forum that collects aggregate messages with no
quality of service or promise of timely delivery. "Just one reply"
doesn't work here.
 
C

Clever Monkey

vubaboota said:
I HAVE SOME SERIOUS PROBLEM , HOW TO MAKE A PROGRAM IN C
Q1:
Write a program using malloc function. In which you take input from
user and allocate memory equal to square of this number. Which
multiply numbers and draw a table in the following format?
Naive attempt:

Start with a large, fixed array. Service allocation requests out of
that large array, keeping track of the location and size of the
allocations. You will get points if you implement a "mark and sweep"
(or similar) algorithm that allows you to compact deallocations.

The rest seem pretty straight-forward, but the devil is in the details.
Sounds like your instructor wants you to use the basic skills you have
been taught, without getting bogged down in details like malloc() [which
can be confusing at first].

There is value in understanding that most any complex data structure can
be built off of an array.
 
G

Guru Jois

Martin Ambuhl said:
Guru Jois wrote:
No, it is horrid. The OP poster asked about swapping two number
[sic].
The '^' operator requires operands of an integer type. And that's
not
all that's wrong with it. This question has been beaten to death
before. If you really are committed to the silly XOR trick, check the
FAQ and the newsgroup archives to find out why you shouldn't be. You
might also find out why, even when the silly XOR trick works, writing
it as a single statement is a bad idea.

And if he must do this really stupid thing, he ought at least to do this
really stupid thing properly. The above is broken in more than the
usual number of ways.

Martin, I note from your reply and from another in this thread that both
Umesh and Guru Jois have started dispensing idiotic C advice. I guess
it's time for them to come *out* of my killfile. Things have come to a
pretty pass when one actually feels obliged to unplonk people for being
even more stupid than normal.

Ya..do it. But it doesn't stop me from posting reply not I mind it.
If I'm wrong, I welcome the comment/objection from experts, b'cause I
always think - " learn from seniors ".

Bye

Guru Jois
 
R

Richard Heathfield

Guru Jois said:

If I'm wrong, I welcome the comment/objection from experts, b'cause I
always think - " learn from seniors ".

Okay, let's see if that's true.

1) Even if the expression which you gave did not exhibit undefined
behaviour (see below), it would not swap two values. Try it! Let's
first break up the expression so that it doesn't break C rules:

b ^= a;
a ^= b;

Let's use nybbles, since they're quicker to type, and see if it works:

a: 0011
b: 0101
b ^= a, so b becomes: 0110

a: 0011
new b: 0110
a ^= b, so a becomes: 0101

This works for a, but not for b.

To fix it, you need another XOR:

b ^= a (giving a new b of 0011).

2) the exchange doesn't work at all on anything other than integer
types, because C doesn't allow bitwise ops on other stuff.

3) consider the special case where a and b are the same object. For
example:

int foo = 6;
int *pa = &foo;
int *pb = &foo;
*pb ^= *pa; /* foo is now 0 */
*pa ^= *pb; /* foo remains 0 */
*pb ^= *pb; /* foo is still 0 */

4) the expression you gave is undefined because it violates a "shall"
that is not a constraint: "Between the previous and next sequence point
an object shall have its stored value modified at most once by the
evaluation of an expression. Furthermore, the prior value shall be
accessed only to determine the value to be stored."
 
B

Ben Bacarisse

Richard Heathfield said:
Guru Jois said:




Okay, let's see if that's true.
4) the expression you gave is undefined because it violates a "shall"
that is not a constraint: "Between the previous and next sequence point
an object shall have its stored value modified at most once by the
evaluation of an expression. Furthermore, the prior value shall be
accessed only to determine the value to be stored."

I don't follow this last one. I am quite prepared to believe that I
am misunderstanding the phrase, but I am simply not seeing it.

a and b have their stored value modified only once (assuming a sequence
point just prior to this, of course) and to me reading of the prior
value of both a and b are used only to determine the value stored.
What have I missed?
 
J

Johan Bengtsson

Martin said:
No, it is horrid. The OP poster asked about swapping two number [sic].
The '^' operator requires operands of an integer type. And that's not
all that's wrong with it. This question has been beaten to death
before. If you really are committed to the silly XOR trick, check the
FAQ and the newsgroup archives to find out why you shouldn't be. You
might also find out why, even when the silly XOR trick works, writing it
as a single statement is a bad idea.

Not that I think either of those solutions is any good but the original
problem contained questions of the type "enter a single digit number". I
personally think integer types is a very good variable type for that.
However the original post also states that it needed to be done with a
macro.
No I am not going to post a solution here either since it so obviously
is homework, and frankly I don't understand why it wouldn't be allowed
to use a third variable. Those suggested solutions so far are much worse
than using a third variable anyway. (What I mean by this is that the
original question is stupid, not the replies)
..
 
I

icub3d

The problem is it has got a LOT worse over the last 2-3 years. It is
getting like spam.

So, how do your treat your e-mail spam? Any normal person knows to
ignore the message and move on. Responding only puts you on their
*hot* list.
 
K

Keith Thompson

Ben Bacarisse said:
I don't follow this last one. I am quite prepared to believe that I
am misunderstanding the phrase, but I am simply not seeing it.

a and b have their stored value modified only once (assuming a sequence
point just prior to this, of course) and to me reading of the prior
value of both a and b are used only to determine the value stored.
What have I missed?

I *think* you're right. Perhaps Richard was thinking of the "correct"
form of the xor swap kludge:

a^=b^=a^=b;

which still has a number of problems.
 
C

Charlton Wilbur

GJ> But anyway Mr Umesh don't spoon feed askers. Don't think that
GJ> we don't know the answer, all are denying the answer to make
GJ> these lazy asker self-dependents.

Anyone who turns in Umesh's code as his own will get only slightly
better than he deserves as a grade.

Charlton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

HELP PLEASE 4
Code help please 4
I dont get this. Please help me!! 2
Help me 4
Please help 2
Total Purchase. Please Help 1
Help please 8
Can anyone please help me in this code 1

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top