473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Segmentation Fault (core dumped)

I wrote this small program to reverse each word in the string. For
example: "I love You" should print as "I evoL uoY". I get Segmentation
Fault (core dumped) error upon running the program. It compiles fine.

// Program to reverse each word in the string
#include<stdio.h>

int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;
count = 0;
while(*p != ' '){
if (*p == '\0') break;
count++;
p++;
}
reverse_string(p, current_pos, count);
if (*p == ' '){
p++;
count++;
current_pos = count;
}
}
puts(p);
return 0;
}

void reverse_string(char* s, int start, int count){
int counter = count/2;
int i = 0;
while(i < counter){
*s = *(s-count);
s--;
i++;
}
}
Any suggestions......Every help is appreciated.

Thanks

Feb 18 '07 #1
29 3567
DanielJohnson wrote:
// Program to reverse each word in the string
#include<stdio.h>

int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;
You correctly note that you want to continue until reaching the null
character in the string.

However you do not have a null character in your string.
Try :
char *p = "my name is daniel\0";

--
Zack
Feb 18 '07 #2
>I wrote this small program to reverse each word in the string. For
>example: "I love You" should print as "I evoL uoY". I get Segmentation
Fault (core dumped) error upon running the program. It compiles fine.
You stored the test string in a quoted string literal. C is permitted
to store such data in a read-only section of the program. If you
try writing on it, KABOOM!

Note also that you keep incrementing p, losing track of where the
beginning of the string is. That's not good when you try to print it.
>
// Program to reverse each word in the string
#include<stdio.h>

int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;
count = 0;
while(*p != ' '){
if (*p == '\0') break;
count++;
p++;
}
reverse_string(p, current_pos, count);
if (*p == ' '){
p++;
count++;
current_pos = count;
}
}
puts(p);
return 0;
}

void reverse_string(char* s, int start, int count){
int counter = count/2;
int i = 0;
while(i < counter){
*s = *(s-count);
s--;
i++;
}
}
Any suggestions......Every help is appreciated.

Thanks

Feb 18 '07 #3
On Feb 18, 12:29 am, Zack <goldszs...@gmail.comwrote:
DanielJohnson wrote:
// Program to reverse each word in the string
#include<stdio.h>
int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;

You correctly note that you want to continue until reaching the null
character in the string.

However you do not have a null character in your string.
Try :
char *p = "my name is daniel\0";

--
Zack
I still get the same error even after putting in \0.

Feb 18 '07 #4
On Feb 18, 12:31 am, gordonb.x6...@burditt.org (Gordon Burditt) wrote:
I wrote this small program to reverse each word in the string. For
example: "I love You" should print as "I evoL uoY". I get Segmentation
Fault (core dumped) error upon running the program. It compiles fine.

You stored the test string in a quoted string literal. C is permitted
to store such data in a read-only section of the program. If you
try writing on it, KABOOM!

Note also that you keep incrementing p, losing track of where the
beginning of the string is. That's not good when you try to print it.
// Program to reverse each word in the string
#include<stdio.h>
int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;
count = 0;
while(*p != ' '){
if (*p == '\0') break;
count++;
p++;
}
reverse_string(p, current_pos, count);
if (*p == ' '){
p++;
count++;
current_pos = count;
}
}
puts(p);
return 0;
}
void reverse_string(char* s, int start, int count){
int counter = count/2;
int i = 0;
while(i < counter){
*s = *(s-count);
s--;
i++;
}
}
Any suggestions......Every help is appreciated.
Thanks
What should I do prevent KABOOM...I am newbie..give me some tips...

Feb 18 '07 #5
>// Program to reverse each word in the string
>#include<stdio.h>

int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;

You correctly note that you want to continue until reaching the null
character in the string.

However you do not have a null character in your string.
> char *p = "my name is daniel";
Yes, there is a null character terminating the above string.
>Try :
char *p = "my name is daniel\0";
That's just a waste of memory, putting in 2 nulls.

Feb 18 '07 #6

On Sat, 17 Feb 2007, Zack wrote:
>
However you do not have a null character in your string.
Try :
char *p = "my name is daniel\0";
If you don't know much about C yet, please try not to volunteer
"answers" to other newbies' questions. You will be wrong, and other
people in the newsgroup will have to spend extra time un-confusing
the newbie. Don't worry, there will always be other newbies --- so
you don't need to jump all over yourself to respond to each one.
You can afford to wait until you know the language better.

To the OP: Ignore Zack's post that I just quoted. Your problem
is with modifying the string literal. Put the string's characters
in an array first; then you'll be able to change their values.

-Arthur
Feb 18 '07 #7
Zack wrote:
DanielJohnson wrote:
>// Program to reverse each word in the string
#include<stdio.h>

int main()
{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
>
You correctly note that you want to continue until reaching the null
character in the string.

However you do not have a null character in your string.
Try :
char *p = "my name is daniel\0";
This is truly horrendous advice. You completely wrong about the absence
of a null character; Daniel's string has one by definition. And that is
not the problem. He is trying to modify a string literal. This is
fully covered in the FAQ. Both you and Daniel should read it.

Daniel needs to declare p not as a pointer to a string literal but to either
a) declare p as a character array
or
b) declare p as a pointer, for which he would then allocate memory
(via malloc) and to which allocated space he would copy the string
literal (via strcpy).
Either of these strategies would give him a modifiable char array.

Feb 18 '07 #8
Arthur J. O'Dwyer wrote:
If you don't know much about C yet, please try not to volunteer
"answers" to other newbies' questions. You will be wrong, and other
people in the newsgroup will have to spend extra time un-confusing
the newbie. Don't worry, there will always be other newbies --- so
you don't need to jump all over yourself to respond to each one.
You can afford to wait until you know the language better.
I will keep quiet.

--
Zack
Feb 18 '07 #9
Zack wrote:
...snip...
I will keep quiet.
That's much better..you messed up with the earlier question as well!
Feb 18 '07 #10
On Feb 17, 9:38 pm, "DanielJohnson" <diffuse...@gmail.comwrote:
On Feb 18, 12:31 am, gordonb.x6...@burditt.org (Gordon Burditt) wrote:
>I wrote this small program to reverse each word in the string. For
>example: "I love You" should print as "I evoL uoY". I get Segmentation
>Fault (core dumped) error upon running the program. It compiles fine.
You stored the test string in a quoted string literal. C is permitted
to store such data in a read-only section of the program. If you
try writing on it, KABOOM!
Note also that you keep incrementing p, losing track of where the
beginning of the string is. That's not good when you try to print it.
>// Program to reverse each word in the string
>#include<stdio.h>
>int main()
>{
void reverse_string(char *, int, int);
char *p = "my name is daniel";
// keeps count of number is char in the word to reverse
int count = 0;
// keeps track of where I started this current word from
int current_pos = 0;
// Conitnue till you reach \0
while(1){
if (*p == '\0') break;
count = 0;
while(*p != ' '){
if (*p == '\0') break;
count++;
p++;
}
reverse_string(p, current_pos, count);
if (*p == ' '){
p++;
count++;
current_pos = count;
}
}
puts(p);
return 0;
>}
>void reverse_string(char* s, int start, int count){
int counter = count/2;
int i = 0;
while(i < counter){
*s = *(s-count);
s--;
i++;
}
>}
>Any suggestions......Every help is appreciated.
>Thanks

What should I do prevent KABOOM...I am newbie..give me some tips...
Read the FAQ at http://c-faq.com/

Feb 18 '07 #11
DanielJohnson said:

<snip>
What should I do prevent KABOOM...I am newbie..give me some tips...
Own the memory you use. There's more to it than just making the data
writeable, however. I changed your program to use writeable data, and
it still blows up. Here is a version that doesn't. Read, mark, learn,
and inwardly digest.

#include <stdio.h/* note the space between ude and <std */

/* function prototypes belong at file scope */
void reverse_substring(char *s,
char *e);

int main(void) /* proper declarator for main */
{
/* own the data */
char data[] = "my name is daniel";

/* keep two pointers - p will track the
beginning of a word, q the end */

char *p = data;
char *q = data;

/* stop when we hit the end */
while(*p != '\0')
{
/* skip past leading spaces */
while(*p == ' ')
{
++p;
}
q = p;
while(*q != '\0' && *q != ' ')
{
++q;
}
if(q p)
{
/* we've found the end of a word, so reverse it */
reverse_substring(p, q - 1);

/* point to start of next word */
p = q;
}
}

/* write the result */
puts(data);
return 0;
}

void reverse_substring(char *s,
char *e)
{
char t = 0;

while(s < e)
{
t = *s;
*s++ = *e;
*e-- = t;
}

/* ain't that a lot simpler? :-) */

return;
}

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Feb 18 '07 #12
"DanielJohnson" <di********@gmail.comwrites:
I wrote this small program to reverse each word in the string. For
example: "I love You" should print as "I evoL uoY". I get Segmentation
Fault (core dumped) error upon running the program. It compiles fine.
[snip]
char *p = "my name is daniel";
[snip]
reverse_string(p, current_pos, count);
The comp.lang.c FAQ is at <http://www.c-faq.com/>. You've asked
question 1.32.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 18 '07 #13
On Feb 18, 6:47 am, Zack <goldszs...@gmail.comwrote:
Arthur J. O'Dwyer wrote:
If you don't know much about C yet, please try not to volunteer
"answers" to other newbies' questions. You will be wrong, and other
people in the newsgroup will have to spend extra time un-confusing
the newbie. Don't worry, there will always be other newbies --- so
you don't need to jump all over yourself to respond to each one.
You can afford to wait until you know the language better.

I will keep quiet.

I don't think that's a good idea. Two proven methods for
learning any subject are: 1) make mistakes, 2) teach someone
else. If you combine those two by making errors while you
try to teach someone, there is only a danger
if you have no one to correct your mistakes.
There is no shortage of such people on c.l.c. If you wait
until you have full mastery of a subject before you try
to answer someone's question, you will never answer
anyone's questions.

It is a good idea, however, to make an effort to ensure
that your replies are correct. A very good way to
gauge that you understand something is to post an explanation
here and see if it gets trounced.

--
Bill Pursell

Feb 18 '07 #14
On Feb 18, 3:08 am, Richard Heathfield <r...@see.sig.invalidwrote:
DanielJohnson said:

<snip>
What should I do prevent KABOOM...I am newbie..give me some tips...

Own the memory you use. There's more to it than just making the data
writeable, however. I changed your program to use writeable data, and
it still blows up. Here is a version that doesn't. Read, mark, learn,
and inwardly digest.

#include <stdio.h/* note the space between ude and <std */

/* function prototypes belong at file scope */
void reverse_substring(char *s,
char *e);

int main(void) /* proper declarator for main */
{
/* own the data */
char data[] = "my name is daniel";

/* keep two pointers - p will track the
beginning of a word, q the end */

char *p = data;
char *q = data;

/* stop when we hit the end */
while(*p != '\0')
{
/* skip past leading spaces */
while(*p == ' ')
{
++p;
}
q = p;
while(*q != '\0' && *q != ' ')
{
++q;
}
if(q p)
{
/* we've found the end of a word, so reverse it */
reverse_substring(p, q - 1);

/* point to start of next word */
p = q;
}
}

/* write the result */
puts(data);
return 0;

}

void reverse_substring(char *s,
char *e)
{
char t = 0;

while(s < e)
{
t = *s;
*s++ = *e;
*e-- = t;
}

/* ain't that a lot simpler? :-) */

return;

}

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999http://www.cpax.org.uk
email: rjh at the above domain, - www.

Thanks for such an elegant solution. I learned two things about string
literal. I apologize that I didn't look up C FAQs before.

I am using gcc compiler on Ubuntu. Is gdb the only debugger in linux.
Can you name a few which can help speed up my progress.

thanks

Feb 18 '07 #15
DanielJohnson said:

<snip>
I am using gcc compiler on Ubuntu. Is gdb the only debugger in linux.
No, but it's "best of breed".
Can you name a few which can help speed up my progress.
Clarity of thought is the best debugger there is. I've spent way too
much time stepping uselessly through code, one line at a time. A penny
of brainwork is worth a pound of code-stepping.

But on the rare occasions when I do use a debugger, gdb is the one I
use. On Linux, I see no more reason to use some other debugger instead
of gdb than I do to use some other C compiler instead of gcc.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Feb 18 '07 #16
On Feb 18, 4:25 pm, "DanielJohnson" <diffuse...@gmail.comwrote:
I am using gcc compiler on Ubuntu. Is gdb the only debugger in linux.
Can you name a few which can help speed up my progress.
An afternoon spent learning gdb will "speed up your progress" day in,
day out for the rest of your life.

--
"One of the great strengths of C from its earliest days has been its
ability to manipulate sequences of characters."
- P. J. Plauger

Feb 18 '07 #17
"DanielJohnson" <di********@gmail.comwrites:
[...]
I am using gcc compiler on Ubuntu. Is gdb the only debugger in linux.
Can you name a few which can help speed up my progress.
<OT>
"ddd" is a graphical frontend to gdb; it can also be used with other
debuggers.
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 18 '07 #18
>>>>"BP" == Bill Pursell <bi**********@gmail.comwrites:

BPIt is a good idea, however, to make an effort to ensure that
BPyour replies are correct. A very good way to gauge that you
BPunderstand something is to post an explanation here and see if
BPit gets trounced.

Posting incorrect information here is not "an effort to ensure that
your replies are correct," however. That involves going to the FAQ
and to the good C references (K&R, the Standard, and Harbison &
Steele) to ensure that you're correct *before* you post.

That said, it's been nearly 20 years since I started programming in C,
and I'm still really gratified when I post code here that nobody finds
flaw in....

Charlton

--
Charlton Wilbur
cw*****@chromatico.net
Feb 18 '07 #19

"Richard Heathfield" <rj*@see.sig.invalidwrote in message
DanielJohnson said:

<snip>
>I am using gcc compiler on Ubuntu. Is gdb the only debugger in linux.

No, but it's "best of breed".
>Can you name a few which can help speed up my progress.

Clarity of thought is the best debugger there is. I've spent way too
much time stepping uselessly through code, one line at a time. A penny
of brainwork is worth a pound of code-stepping.

But on the rare occasions when I do use a debugger, gdb is the one I
use. On Linux, I see no more reason to use some other debugger instead
of gdb than I do to use some other C compiler instead of gcc.
My problem is that I am always switching systems.
Once you get into a compile / debug habit, it is a real nuisance to have to
adapt to a different debugger. So generally I just don't use them.
Feb 18 '07 #20
"Arthur J. O'Dwyer" wrote:
>
On Sat, 17 Feb 2007, Zack wrote:

However you do not have a null character in your string.
Try :
char *p = "my name is daniel\0";

If you don't know much about C yet, please try not to volunteer
"answers" to other newbies' questions. You will be wrong, and other
people in the newsgroup will have to spend extra time un-confusing
the newbie. Don't worry, there will always be other newbies --- so
you don't need to jump all over yourself to respond to each one.
You can afford to wait until you know the language better.
[...]

On the other hand, posting "wrong" answers will be quickly corrected,
as long as they are C related. (One of the reasons that keeps getting
pointed out as to why you shouldn't give OT answers to OT questions,
without at least pointing them somewhere they can be on-topic -- the
fact that posters here can't necessarily correct "wrong" answers as
this.)

Also, it's not just newbies that post "wrong" answers. I have been
programming in C for over 20 years, and I have been corrected here
on more than one occasion, when I posted an answer based on what I
"learned" 20 years ago, and which turned out to be wrong.

Besides, now Zack's misconception won't get in the way in the future.

However, I do agree that newbies should take their time before
making such bold answers. (Though it is a bit of a Catch-22, since
no one would have corrected Zack's misconception had he not posted.)

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Feb 19 '07 #21
Kenneth Brody wrote:
"Arthur J. O'Dwyer" wrote:
If you don't know much about C yet, please try not to volunteer
"answers" to other newbies' questions.
On the other hand, posting "wrong" answers will be quickly corrected,
as long as they are C related.

My recommendation is for the less experienced participants to answer
the question in their heads, then compare with the posted answers. If
there's a major difference, and it's not clear why, then ask about it.


Brian
Feb 19 '07 #22
Richard Heathfield wrote:
DanielJohnson said:

<snip>
>I am using gcc compiler on Ubuntu. Is gdb the only debugger in linux.

No, but it's "best of breed".
>Can you name a few which can help speed up my progress.

Clarity of thought is the best debugger there is. I've spent way too
much time stepping uselessly through code, one line at a time. A penny
of brainwork is worth a pound of code-stepping.
And depending on when you started, this could be 240 to 1. :-)

On my first trip to England, about 40 years ago now, a pint of bitter
cost one and six. A tot of gin with tonic was two shillings. Those were
the days.

Twelve pence to the shilling, twenty shillings to the Pound. As I recall
a Pound cost about five Dollars US. Those were the days.

I haven't been back to the UK for thirty years now. What does a pint of
bitter cost today?

Here in Washington, DC a drink (even beer) will average five to six
dollars today in nicer places. Two dollars is about as low as you can go.

Do y'all still drive on the 'wrong' side of the road? Why is that?

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Feb 19 '07 #23
Joe Wright said:

<snip>
I haven't been back to the UK for thirty years now. What does a pint
of bitter cost today?
A couple of quid (about four bucks, I think).
Here in Washington, DC a drink (even beer) will average five to six
dollars today in nicer places. Two dollars is about as low as you can
go.

Do y'all still drive on the 'wrong' side of the road?
Nobody here drives on the wrong side of the road, except when overtaking
or when risking the wrath of the law (and society at large) by driving
home from spending a tenner in the pub...
Why is that?
Well, if you're asking why we drive on the proper - i.e. the left - side
of the road, the answer is simple: if the driver of the oncoming
vehicle attacks you, you want him on your right, because that's the
side on which your sword will be most effective (if, like most people,
you're right-handed). You can use the other hand to control the horses.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Feb 19 '07 #24
In article <DN******************************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>Well, if you're asking why we drive on the proper - i.e. the left - side
of the road, the answer is simple: if the driver of the oncoming
vehicle attacks you, you want him on your right, because that's the
side on which your sword will be most effective (if, like most people,
you're right-handed).
I knew there was a reason I never learnt to drive.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Feb 19 '07 #25
On Feb 19, 6:18 pm, Richard Heathfield <r...@see.sig.invalidwrote:
Joe Wright said:

<snip>
I haven't been back to the UK for thirty years now. What does a pint
of bitter cost today?

A couple of quid (about four bucks, I think).
Here in Washington, DC a drink (even beer) will average five to six
dollars today in nicer places. Two dollars is about as low as you can
go.
Do y'all still drive on the 'wrong' side of the road?

Nobody here drives on the wrong side of the road, except when overtaking
or when risking the wrath of the law (and society at large) by driving
home from spending a tenner in the pub...
Why is that?

Well, if you're asking why we drive on the proper - i.e. the left - side
of the road, the answer is simple: if the driver of the oncoming
vehicle attacks you, you want him on your right, because that's the
side on which your sword will be most effective (if, like most people,
you're right-handed). You can use the other hand to control the horses.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999http://www.cpax.org.uk
email: rjh at the above domain, - www.
I came across this link on wikipedia about left and right hand
driving. I visited UK this December and was pleasantly surprised to ee
the traffic the other way but in couple of days I think I could
adjust.

http://en.wikipedia.org/wiki/Driving..._left_or_right

Daniel

http://en.wikipedia.org/wiki/Driving..._left_or_right

Feb 20 '07 #26
Richard Heathfield wrote:
Joe Wright said:
.... snip ...
>>
Do y'all still drive on the 'wrong' side of the road?

Nobody here drives on the wrong side of the road, except when
overtaking or when risking the wrath of the law (and society at
large) by driving home from spending a tenner in the pub...
>Why is that?

Well, if you're asking why we drive on the proper - i.e. the
left - side of the road, the answer is simple: if the driver of
the oncoming vehicle attacks you, you want him on your right,
because that's the side on which your sword will be most
effective (if, like most people, you're right-handed). You can
use the other hand to control the horses.
I think that story is flawed. In the envisioned scenario, you
could get better sword action by keeping right. However, for
couched lances, keeping left makes more sense. Check it out with
Galahad, Lancelot, Bedevere, etc.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Feb 20 '07 #27
CBFalconer said:
Richard Heathfield wrote:
>>
Well, if you're asking why we drive on the proper - i.e. the
left - side of the road, the answer is simple: if the driver of
the oncoming vehicle attacks you, you want him on your right,
because that's the side on which your sword will be most
effective (if, like most people, you're right-handed). You can
use the other hand to control the horses.

I think that story is flawed. In the envisioned scenario, you
could get better sword action by keeping right.
I disagree, and suggest that we test the matter by pitting the two
techniques against each other. We'll start our stagecoaches at opposite
ends of the lane, draw swords, and - on the word of command - set off
towards each other, with my vehicle firmly on the left side of the road
and yours firmly on the right. Last one standing buys the drinks.
However, for
couched lances, keeping left makes more sense. Check it out with
Galahad, Lancelot, Bedevere, etc.
I don't think they ever drove vehicles for a living.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Feb 20 '07 #28
Joe Wright <jo********@comcast.netwrote:
Richard Heathfield wrote:
Clarity of thought is the best debugger there is. I've spent way too
much time stepping uselessly through code, one line at a time. A penny
of brainwork is worth a pound of code-stepping.
And depending on when you started, this could be 240 to 1. :-)

On my first trip to England, about 40 years ago now, a pint of bitter
cost one and six. A tot of gin with tonic was two shillings. Those were
the days.

Twelve pence to the shilling, twenty shillings to the Pound. As I recall
a Pound cost about five Dollars US. Those were the days.

I haven't been back to the UK for thirty years now. What does a pint of
bitter cost today?
Depends. Do you want to pay Cock's Egg Tax or not?
Here in Washington, DC a drink (even beer) will average five to six
dollars today in nicer places. Two dollars is about as low as you can go.
I don't think you could easily get a pint under two pounds in the Great
Wen. You certainly can easily get one more expensive than that. They're
cheaper Oop North.
Do y'all still drive on the 'wrong' side of the road? Why is that?
Yes, because they're still all brigands.

Richard
Feb 20 '07 #29
On Mon, 19 Feb 2007 23:18:37 +0000, in comp.lang.c , Richard
Heathfield <rj*@see.sig.invalidwrote:
>Joe Wright said:

<snip>
>I haven't been back to the UK for thirty years now. What does a pint
of bitter cost today?

A couple of quid (about four bucks, I think).
Crikey. You clearly don't live in London... :-(
>Do y'all still drive on the 'wrong' side of the road?
Only after drinking lots of bitter...

--
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
Feb 22 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sivignon | last post by:
Hi, I'm writing a php script which deals with 3 ORACLE databases. This script is launch by a script shell on an linux machine like this : /../php/bin/php ./MySript.php (PHP 4.3.3) My script...
13
by: N.S. du Toit | last post by:
Just having a bit of trouble programming with C under FreeBSD 5.1 using the gcc compiler. I'm a bit new to C so my apologies if the answer to my question appear obvious :) Basically I've...
0
by: dboileau | last post by:
Can anyone help me out with this error, I am trying to compile mysql with gcc 3.4.6 (Compiled from source) using CC=gcc CFLAGS="-O3 -mcpu=v8 -Wa,-xarch=v8plusa" \ CXX=gcc CXXFLAGS="-O3...
6
by: Wes | last post by:
I'm running FreeBSD 6.1 RELEASE #2. The program is writting in C++. The idea of the program is to open one file as input, read bytes from it, do some bitwise operations on the bytes, and then...
1
by: kumarangopi | last post by:
two.c: #include<stdio.h> main() { printf("hello C is working"); } #gcc -0 two two.c #./two segmetnation fault
6
by: DanielJohnson | last post by:
int main() { printf("\n Hello World"); main; return 0; } This program terminate just after one loop while the second program goes on infinitely untill segmentation fault (core dumped) on...
2
by: Verdana | last post by:
We're using Python 2.5 on our production and testing servers, which both run SunOS 5.8 and Oracle 10g. The script we're working on is supposed to process wddx packets, enter some info in the database...
8
by: Bryan | last post by:
Hello all. I'm fairly new to c++. I've written several programs using std::vectors, and they've always worked just fine. Until today. The following is a snippet of my code (sorry, can't...
5
by: johnericaturnbull | last post by:
Hi - I am very new to python. I get this random core dump and am looking for a good way to catch the error. I know the function my core dump occurs. Is there any error catching/handling that I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.