473,320 Members | 2,071 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,320 software developers and data experts.

learn me c

hi friends,
im anand im just a beginner in c learning for the past two
weeksnow i can write simple prgs can anyone help me to get well known
to c lang so that i should able to write even tough prgs in c

Sep 23 '06 #1
31 2569
It has taken me 1 year to learn C. I did this by reading a c++ book,
then reading a generally available c book, then trying to program and
making so many mistakes it is unbelievable (well actually to the c
guru's out there - Heathfield and Thompson - this probably is
believable), and then when I thought I knew c I bought a copy of K & R.
Only after reading that do I now feal comfortable with c.

I think unless you are a robot the only way you are gonna learn is by
reading, making mistakes and learning by them.

Sorry if this is not much help.

P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.

Sep 23 '06 #2
This is all worng.

newbie wrote:
It has taken me 1 year to learn C. I did this by reading a c++ book,
then reading a generally available c book, then trying to program and
making so many mistakes it is unbelievable (well actually to the c
guru's out there - Heathfield and Thompson - this probably is
believable), and then when I thought I knew c I bought a copy of K & R.
Only after reading that do I now feal comfortable with c.
Absoultely not. There is no reason to learn C++ before C, it will just
confuse the hell out of you. Don't do any of this. The best place to
start isn't even IN a book, its in a simple tutorial. K & R is far to
hard for a beginner to read, but some other books are okay. There are
pleanty of other ways to get confortable with C. Just google C
tutorials. What skill level are you? What do you know now? What do
you want to learn?
I think unless you are a robot the only way you are gonna learn is by
reading, making mistakes and learning by them.
This is also wrong. You can't exactly make mistakes reading and if you
do you have much bigger problems. In C mistakes are not learned from
so much as made into habits (if they don't generate errors). My
biggest tip if you have a warning FIX IT.

Actually, robots don't learn anything, they just do what they are
programmed to and pick up information if that is what they're
instructions told them to. What are you trying to say.

Any the only way to learn C is to use it! You can't just read and
learn. Copy the source in the tutorial or book. Not copy and paist,
manually type it up as a copy, that really helps, then use what you
learned to make programs.

All reading and no compiling will make gcc a dull boy.
(assuming you use gcc which imho you should however this is off topic
for this group.
Sorry if this is not much help.
Its not, if you want to LEARN C and not just be farmilliar with it.
P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.
This is not true at all. In order to learn C you do not have to buy
any books at all, it helps by is not required. All sorts of info is
free in the maigcal world were EVERYTHING is, called the internet.
Hope this helps erase what he just told you.
Nori

P.S. You did not learn C in a year, it is not possible to learn the
whole language, and it is less possible to do it in a year. I have
been LEARNING C for the past 4 years and I still have barely touched
the tip of the iceberg. A good understanding, a great understanding
even, is very differnt than KNOWING the whole thing.
N

Sep 23 '06 #3

no*********@gmail.com wrote:
This is all worng.
I think you mean "wrong"! And I think you forget this is my opinion
and situation. If this was not the case for you then don't worry I
have not implied that this is the opinion of all c programmers. But I
am sure you will rip my words apart and tell me that I did.
>
newbie wrote:
It has taken me 1 year to learn C. I did this by reading a c++ book,
then reading a generally available c book, then trying to program and
making so many mistakes it is unbelievable (well actually to the c
guru's out there - Heathfield and Thompson - this probably is
believable), and then when I thought I knew c I bought a copy of K & R.
Only after reading that do I now feal comfortable with c.

Absoultely not. There is no reason to learn C++ before C, it will just
confuse the hell out of you. Don't do any of this. The best place to
start isn't even IN a book, its in a simple tutorial. K & R is far to
hard for a beginner to read, but some other books are okay. There are
pleanty of other ways to get confortable with C. Just google C
tutorials. What skill level are you? What do you know now? What do
you want to learn?
Oh dear you seem to have taken most of my comments literally, for
example the robot comment below, but, and quite the opposit, you seem
to have decided that I implied that he should learn c++ first! I
merely said that I read a c++ book before learning c.
I think unless you are a robot the only way you are gonna learn is by
reading, making mistakes and learning by them.

This is also wrong. You can't exactly make mistakes reading and if you
do you have much bigger problems. In C mistakes are not learned from
so much as made into habits (if they don't generate errors). My
biggest tip if you have a warning FIX IT.
Do you not think that by usimg the internet etc, that you are going to
be "reading"! Also I did say by making mistakes. How can you make
mistakes if you don't actually compile and run any programs. I would
have thought this would be implied. Sorry if this is not!
Actually, robots don't learn anything, they just do what they are
programmed to and pick up information if that is what they're
instructions told them to. What are you trying to say.
Who said anything different?
Any the only way to learn C is to use it! You can't just read and
learn. Copy the source in the tutorial or book. Not copy and paist,
manually type it up as a copy, that really helps, then use what you
learned to make programs.

All reading and no compiling will make gcc a dull boy.
(assuming you use gcc which imho you should however this is off topic
for this group.
Why can't you learn something by just reading? I am not impying that I
used this method - although you seem to have taken this quite
literally!
Sorry if this is not much help.

Its not, if you want to LEARN C and not just be farmilliar with it.
Maybe for you. But of course you should remember this is an opinion
and not a fact so there's no need for you to get all defensive and
corrective. But I am sure you will do it again.
P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.

This is not true at all. In order to learn C you do not have to buy
any books at all, it helps by is not required. All sorts of info is
free in the maigcal world were EVERYTHING is, called the internet.
Hope this helps erase what he just told you.
Nori
I don't understand, can no-one apart from yourself have an opinion on
something?
P.S. You did not learn C in a year, it is not possible to learn the
whole language, and it is less possible to do it in a year. I have
been LEARNING C for the past 4 years and I still have barely touched
the tip of the iceberg. A good understanding, a great understanding
even, is very differnt than KNOWING the whole thing.
N
Hey, if that's your level of c after that period of time then good for
you. People learn at different rates. If I were a rocket scientist
would you still expect me not to learn c in a short period?

Sep 23 '06 #4
People learn at differnt rates, and I was meerly stating my opion, I
didn't mean for it to appear the way that it did reading it over.
Sorry.
Nori

P.S.
People learn at differnt rates, I was trying to modest. If you want to
know
I have made a:
-Linux web browser
-Linux text editor
-Windows text editor
-Cross platform shell
-A text based adventure game
-A IDE for my (that works on linux and windows)
-Scripting language

All in C. I'm not saying I learn slow, I am saying that there is
always more to learn. I guess you never heard of hacker ethics, thats
okay.

Also, It just shows how great a person you are for trashing someone
else. I was meerly saying that I disagreed with your ideas, I should
have put inho at the top of the post, but I didn't again sorry.
I however didn't insult you in any shape mannor or form where as you
insulted me:
But I am sure you will rip my words apart and tell me that I did.
But I am sure you will do it again.
And btw you stated nowere in your post that this was your opinion.
Also, the robot thing was a joke, oh well.
N

newbie wrote:
no*********@gmail.com wrote:
This is all worng.

I think you mean "wrong"! And I think you forget this is my opinion
and situation. If this was not the case for you then don't worry I
have not implied that this is the opinion of all c programmers. But I
am sure you will rip my words apart and tell me that I did.

newbie wrote:
It has taken me 1 year to learn C. I did this by reading a c++ book,
then reading a generally available c book, then trying to program and
making so many mistakes it is unbelievable (well actually to the c
guru's out there - Heathfield and Thompson - this probably is
believable), and then when I thought I knew c I bought a copy of K & R.
Only after reading that do I now feal comfortable with c.
>
Absoultely not. There is no reason to learn C++ before C, it will just
confuse the hell out of you. Don't do any of this. The best place to
start isn't even IN a book, its in a simple tutorial. K & R is far to
hard for a beginner to read, but some other books are okay. There are
pleanty of other ways to get confortable with C. Just google C
tutorials. What skill level are you? What do you know now? What do
you want to learn?

Oh dear you seem to have taken most of my comments literally, for
example the robot comment below, but, and quite the opposit, you seem
to have decided that I implied that he should learn c++ first! I
merely said that I read a c++ book before learning c.
I think unless you are a robot the only way you are gonna learn is by
reading, making mistakes and learning by them.
>
This is also wrong. You can't exactly make mistakes reading and if you
do you have much bigger problems. In C mistakes are not learned from
so much as made into habits (if they don't generate errors). My
biggest tip if you have a warning FIX IT.

Do you not think that by usimg the internet etc, that you are going to
be "reading"! Also I did say by making mistakes. How can you make
mistakes if you don't actually compile and run any programs. I would
have thought this would be implied. Sorry if this is not!
Actually, robots don't learn anything, they just do what they are
programmed to and pick up information if that is what they're
instructions told them to. What are you trying to say.

Who said anything different?
Any the only way to learn C is to use it! You can't just read and
learn. Copy the source in the tutorial or book. Not copy and paist,
manually type it up as a copy, that really helps, then use what you
learned to make programs.

All reading and no compiling will make gcc a dull boy.
(assuming you use gcc which imho you should however this is off topic
for this group.

Why can't you learn something by just reading? I am not impying that I
used this method - although you seem to have taken this quite
literally!
Sorry if this is not much help.
>
Its not, if you want to LEARN C and not just be farmilliar with it.

Maybe for you. But of course you should remember this is an opinion
and not a fact so there's no need for you to get all defensive and
corrective. But I am sure you will do it again.
P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.
This is not true at all. In order to learn C you do not have to buy
any books at all, it helps by is not required. All sorts of info is
free in the maigcal world were EVERYTHING is, called the internet.
Hope this helps erase what he just told you.
Nori

I don't understand, can no-one apart from yourself have an opinion on
something?
P.S. You did not learn C in a year, it is not possible to learn the
whole language, and it is less possible to do it in a year. I have
been LEARNING C for the past 4 years and I still have barely touched
the tip of the iceberg. A good understanding, a great understanding
even, is very differnt than KNOWING the whole thing.
N

Hey, if that's your level of c after that period of time then good for
you. People learn at different rates. If I were a rocket scientist
would you still expect me not to learn c in a short period?
Sep 23 '06 #5
"no*********@gmail.com" <no*********@gmail.comwrites:
This is all worng.
No it isn't.
newbie wrote:
>It has taken me 1 year to learn C. I did this by reading a c++ book,
then reading a generally available c book, then trying to program and
making so many mistakes it is unbelievable (well actually to the c
guru's out there - Heathfield and Thompson - this probably is
believable), and then when I thought I knew c I bought a copy of K & R.
Only after reading that do I now feal comfortable with c.

Absoultely not. There is no reason to learn C++ before C, it will just
confuse the hell out of you. Don't do any of this. The best place to
start isn't even IN a book, its in a simple tutorial. K & R is far to
hard for a beginner to read, but some other books are okay. There are
pleanty of other ways to get confortable with C. Just google C
tutorials. What skill level are you? What do you know now? What do
you want to learn?
K&R is perfectly fine for a beginner to read, although most people will
want to read it slowly. It certainly isn't difficult; it's just very
dense, if anything.
>I think unless you are a robot the only way you are gonna learn is by
reading, making mistakes and learning by them.

This is also wrong. You can't exactly make mistakes reading and if you
do you have much bigger problems. In C mistakes are not learned from
so much as made into habits (if they don't generate errors). My
biggest tip if you have a warning FIX IT.
Okay. You said that he was wrong, and continued to "correct" him
with his own idea in different words.

<snipped similar>
>Sorry if this is not much help.

Its not, if you want to LEARN C and not just be farmilliar with it.
Right. I often become familiar with stuff without learning it. In
fact, I use it so often that I've no idea how to even use it! Wait...
>P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.

This is not true at all. In order to learn C you do not have to buy
any books at all, it helps by is not required. All sorts of info is
free in the maigcal world were EVERYTHING is, called the internet.
Hope this helps erase what he just told you.
Nori
Actually, K&R will give you a lot of correct information for a very
low cost. The Internet will give you a whole lot of crap, and it's
impossible for you to sift through it unless you already know the
language.
P.S. You did not learn C in a year, it is not possible to learn the
whole language, and it is less possible to do it in a year. I have
been LEARNING C for the past 4 years and I still have barely touched
the tip of the iceberg. A good understanding, a great understanding
even, is very differnt than KNOWING the whole thing.
N
It's not possible to learn the whole language in a year? There's under
100 keywords and operators, so even at the slow rate of one per day,
you can still learn it in a month or three.

--
Andrew Poelstra <http://www.wpsoftware.net/projects>
To reach me by email, use `apoelstra' at the above domain.
"Do BOTH ends of the cable need to be plugged in?" -Anon.
Sep 23 '06 #6
no*********@gmail.com wrote:
P.S. You did not learn C in a year, it is not possible to learn the
whole language, and it is less possible to do it in a year.
Students in a local university program get about two weeks to learn
enough C to write for example, a program that shuffles a deck of cards,
deals poker hands, and evaluates the hands according to the rules of a
card game.

Two weeks later, they are doing substantial amounts of text processing
with pointer arithmetic, and two weeks after that they are doing dynamic
memory, structs, are starting to get a *very* good grasp of the standard
C library, can deal with the most complex C syntax, and they also know
enough of make and the linker to get by, at least in a GCC-based
environment.

That's six weeks, give or take. The C language is not complex enough to
spend "a year" learning it. Learning how to *apply* the language, that
is of course something you will do for the rest of your career.

I also disagree with the claim that K&R2 is not appropriate for a
beginner. It is a very friendly book, if a bit terse, and it does start
from the beginning concepts. What's the problem?

I agree with your basic premise that hands-on experience is the best
approach.

I don't understand what is taking you 4 years to learn. I can't imagine
that there is anything in the syntax or the standard library that you
don't know.
Sep 23 '06 #7
Andrew Poelstra wrote:
It's not possible to learn the whole language in a year? There's under
100 keywords and operators, so even at the slow rate of one per day,
you can still learn it in a month or three.
It took me a few days to get an overview of the standard library. The
reason was I had jury duty which had a lot of waiting, and one of the
books I took with me was a P.J. Plauger C library reference. I read it
cover to cover!

Anyway the point is, there's very little *to* learn about the C language
itself. There are a handful of concepts that may take a certain type of
thought process to really grasp (pointer arithmetic, standards being
distinct from the implementation, and complexities that arise from the
simple grammar), but then there's the library, which also is not huge,
but must be learned as well as the language. Then of course, the
learner is faced with libraries that are specific to a target system, or
specific to some domain of applications. He might need to learn how to
program with unix sockets, or to do graphics on some graphical system,
or he might need to learn curses or other I/O libraries of that nature.
That can take years and years.

But I don't see how it takes more than a few days to actually "Learn the
C language." It's not that complex a grammar.
Sep 23 '06 #8
"no*********@gmail.com" wrote:
>
People learn at differnt rates, and I was meerly stating my opion, I
didn't mean for it to appear the way that it did reading it over.
Please refrain from top-posting. Your comments should appear after
(or intermixed with) the relevant quoted material, i.e. after
snipping irrelevant quotes. See the following links in my sig.

--
Some informative links:
<news:news.announce.newusers
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
Sep 24 '06 #9
no*********@gmail.com said:

<snip>
The best place to
start isn't even IN a book, its in a simple tutorial.
Wrong.
K & R is far to hard for a beginner to read,
Wrong.
Just google C tutorials.
And wrong.

There are so many terrible C tutorials out there. How is a beginner to know
which are good and which bad?
<more junk snipped>
>P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.

This is not true at all.
Yes, it is true. I think newbie knows a lot more about this than you do.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 24 '06 #10
"jmcgill" <jm*****@email.arizona.eduwrote in message
Andrew Poelstra wrote:
>It's not possible to learn the whole language in a year? There's under
100 keywords and operators, so even at the slow rate of one per day,
you can still learn it in a month or three.

It took me a few days to get an overview of the standard library. The
reason was I had jury duty which had a lot of waiting, and one of the
books I took with me was a P.J. Plauger C library reference. I read it
cover to cover!

Anyway the point is, there's very little *to* learn about the C language
itself. There are a handful of concepts that may take a certain type of
thought process to really grasp (pointer arithmetic, standards being
distinct from the implementation, and complexities that arise from the
simple grammar), but then there's the library, which also is not huge,
but must be learned as well as the language. Then of course, the
learner is faced with libraries that are specific to a target system, or
specific to some domain of applications. He might need to learn how to
program with unix sockets, or to do graphics on some graphical system,
or he might need to learn curses or other I/O libraries of that nature.
That can take years and years.

But I don't see how it takes more than a few days to actually "Learn the
C language." It's not that complex a grammar.
A bought a book on C++ in Leeds, and took the bus to Bradford. I read it,
and by the time the bus had arrived, I knew C++.
That is to say, I knew all the keywords and what they meant, I knew how to
declare clas hierarchies, I knew the quirks like overloaded operators.

However fifteen years or whatever later, I am still learning how to use C++
effectively. Or to be more accurate, I've given up. I took the decision a
couple of years ago not to write any new code in C++ as long as I have the
final say in the matter.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Sep 24 '06 #11
Malcolm wrote:
"jmcgill" <jm*****@email.arizona.eduwrote in message
But I don't see how it takes more than a few days to actually "Learn the
C language." It's not that complex a grammar.
A bought a book on C++ in Leeds, and took the bus to Bradford. I read it,
and by the time the bus had arrived, I knew C++.
That is to say, I knew all the keywords and what they meant, I knew how to
declare clas hierarchies, I knew the quirks like overloaded operators.
How long does the bus from Leeds to Bradford take ,
about an hour ? Books on C++ tend to be hundreds
of pages long ; if you managed to read hundereds of
pages within 1 hour then you're a very talented person.
Did you also read and understand all the code examples
the book had ? Even without that it is still an amazing feat.
Did you remember a few days afterwards the meaning of
all the keywords ? If yes your memory is impressive.

I suspect different people mean different things by "learn"
in this thread. But I don't know how to make it more concrete.
Personally I can't imagine in my wildest dreams learning C in
a few days.

Sep 24 '06 #12
hi friend,
thanks for ur idea now i need someone to give me some question
i.e to give me a question for prog to do for eg:to find prime no. it
might be simple ones for u peoples who were in high level in 'c' but i
need this type of coaching for me will any one help me so that i can
develop my programming knowledge
newbie wrote:
It has taken me 1 year to learn C. I did this by reading a c++ book,
then reading a generally available c book, then trying to program and
making so many mistakes it is unbelievable (well actually to the c
guru's out there - Heathfield and Thompson - this probably is
believable), and then when I thought I knew c I bought a copy of K & R.
Only after reading that do I now feal comfortable with c.

I think unless you are a robot the only way you are gonna learn is by
reading, making mistakes and learning by them.

Sorry if this is not much help.

P.S. If your gonna learn c you must buy a copy of K & R. I think the
fact that I had already read other programming books before reading it
definately helped me because they do assume that you are familiar with
a programming concept.
Sep 24 '06 #13
anand devarajan wrote:
hi friend,
thanks for ur idea now i need someone to give me some question
i.e to give me a question for prog to do
Here's a vague idea for a project that will take you through a lot of
useful concepts:
1. Model a deck of playing cards.

2. Shuffle the cards.

3. Deal poker hands from the deck.

4. Evaluate the relative values of the hands dealt.

5. Implement betting, and draw-poker with turns.

Sep 24 '06 #14
sorry i dont know anything about cards so u give me someother project
work(note that the question u frame is to a beginner in c)
jmcgill wrote:
anand devarajan wrote:
hi friend,
thanks for ur idea now i need someone to give me some question
i.e to give me a question for prog to do

Here's a vague idea for a project that will take you through a lot of
useful concepts:
1. Model a deck of playing cards.

2. Shuffle the cards.

3. Deal poker hands from the deck.

4. Evaluate the relative values of the hands dealt.

5. Implement betting, and draw-poker with turns.
Sep 24 '06 #15
sorry i dont know anything about cards so u give me someother project
work(note that the question u frame is to a beginner in c)
jmcgill wrote:
anand devarajan wrote:
hi friend,
thanks for ur idea now i need someone to give me some question
i.e to give me a question for prog to do

Here's a vague idea for a project that will take you through a lot of
useful concepts:
1. Model a deck of playing cards.

2. Shuffle the cards.

3. Deal poker hands from the deck.

4. Evaluate the relative values of the hands dealt.

5. Implement betting, and draw-poker with turns.
Sep 24 '06 #16
anand devarajan wrote:
sorry i dont know anything about cards so u give me someother project
work(note that the question u frame is to a beginner in c)
What I described is essentially the first significant programming
project in a local university course that includes the introduction
to C.

For the first iteration of the project, to be fair, the deck of cards
and the functions to shuffle and deal them are provided -- but in later
iterations the students are expected to implement them.
Here's a simpler idea for you:

Write a C program that will read standard input and output the number of
characters, the number of words, and the number of lines in the input.

Extend this to allow a filename argument as well as standard input.

Next, write a C program that will echo its command-line arguments to
standard output.

Extend this to allow the arguments "-c" "-w", or "-l".

Extend the program in the first part to enable the user to select
whether to count characters, words, or lines.
Sep 24 '06 #17
jmcgill <jm*****@email.arizona.eduwrites:
[...]
Here's a simpler idea for you:

Write a C program that will read standard input and output the number of
characters, the number of words, and the number of lines in the input.
Note that this requires defining exactly what a "word" is. Consider
constructing a rigorous definition to be part of the exercise. Think
about punctuation, digits, whitespace, etc.
Extend this to allow a filename argument as well as standard input.

Next, write a C program that will echo its command-line arguments to
standard output.

Extend this to allow the arguments "-c" "-w", or "-l".
I presume that refers to the word count program, not the echo program.
Extend the program in the first part to enable the user to select
whether to count characters, words, or lines.
--
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.
Sep 25 '06 #18
Keith Thompson wrote:
jmcgill <jm*****@email.arizona.eduwrites:
[...]
>Here's a simpler idea for you:

Write a C program that will read standard input and output the number of
characters, the number of words, and the number of lines in the input.

Note that this requires defining exactly what a "word" is. Consider
constructing a rigorous definition to be part of the exercise. Think
about punctuation, digits, whitespace, etc.
I'm being intentionally lazy in describing the problem because I have
very little confidence that the person asking for ideas intends to
follow through on them.
>Extend this to allow a filename argument as well as standard input.

Next, write a C program that will echo its command-line arguments to
standard output.

Extend this to allow the arguments "-c" "-w", or "-l".

I presume that refers to the word count program, not the echo program.
Well, the way I'd assign it, it would end up being each.

First echo arbitrary parameters, then interpret those parameters, then
merge the other effort with this one, and you're on your way to
implementing "wc",

I wish I could have thought of a more interesting assignment, but card
games seemed to have met with a cultural barrier of some sort, and I
pretty much lost interest.
Sep 25 '06 #19
anand devarajan wrote:
sorry i dont know anything about cards so u give me someother project
work(note that the question u frame is to a beginner in c)
How about one that delivers electric shocks to top-posters?

Of course, that would require platform-specific elements.

Brian
Sep 25 '06 #20
Default User wrote:
anand devarajan wrote:
>sorry i dont know anything about cards so u give me someother
project work(note that the question u frame is to a beginner in c)

How about one that delivers electric shocks to top-posters?
Of course, that would require platform-specific elements.
Since 98.34% of those are winders users, it would suffice to apply
the blue screen of death. This could also be used on detecting an
isolated u or lowercase i. This can be done on all the aforesaid
winders systems. Provision needs to be made for allowing such in
source code.

--
Some informative links:
<news:news.announce.newusers
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
Sep 25 '06 #21

jmcgill <jm*****@email.arizona.eduwrote in message
news:YKBRg.153$rS.30@fed1read05...
thanks for ur idea now i need someone to give me some question
i.e to give me a question for prog to do

Here's a vague idea for a project that will take you through a lot of
useful concepts:

1. Model a deck of playing cards.

2. Shuffle the cards.

3. Deal poker hands from the deck.

4. Evaluate the relative values of the hands dealt.

5. Implement betting, and draw-poker with turns.
As somebody who's actually done this in both languages, I can
say this is much better accomplished in C++ than C, because C++
is "object-oriented".

The real brilliance is coming up with a well thought-out
heirarchy of classes: "Card", "Deck_Cards", "Player", "Dealer",
"Table", etc., for one game (I started with blackjack), then
just reusing them with a "Game" class that uses different
"game rules" to "quickly" model another game (blackjack to
poker, or vice versa), as opposed to just starting over
completely from scratch in C.

Just sayin'...

---
William Ernest Reid

Sep 26 '06 #22
"Bill Reid" <ho********@happyhealthy.netwrites:
jmcgill <jm*****@email.arizona.eduwrote in message
news:YKBRg.153$rS.30@fed1read05...
thanks for ur idea now i need someone to give me some question
i.e to give me a question for prog to do

Here's a vague idea for a project that will take you through a lot of
useful concepts:

1. Model a deck of playing cards.

2. Shuffle the cards.

3. Deal poker hands from the deck.

4. Evaluate the relative values of the hands dealt.

5. Implement betting, and draw-poker with turns.
As somebody who's actually done this in both languages, I can
say this is much better accomplished in C++ than C, because C++
is "object-oriented".

The real brilliance is coming up with a well thought-out
heirarchy of classes: "Card", "Deck_Cards", "Player", "Dealer",
"Table", etc., for one game (I started with blackjack), then
just reusing them with a "Game" class that uses different
"game rules" to "quickly" model another game (blackjack to
poker, or vice versa), as opposed to just starting over
completely from scratch in C.
In C you can "emulate" OO, and IMHO, this is actually clearer
in a lot of situations. In this case I wouldn't care either way:

Deck d = new Deck;
d.Shuffle();
Card c = d.drawFromAll();

As opposed to:
Deck d = create_deck();
Card c;
shuffle (d);
c = draw_from_all (c);

--
Andrew Poelstra <http://www.wpsoftware.net/projects>
To reach me by email, use `apoelstra' at the above domain.
"Do BOTH ends of the cable need to be plugged in?" -Anon.
Sep 26 '06 #23
Andrew Poelstra <ap*******@false.sitewrites:
Deck d = create_deck();
Card c;
shuffle (d);
c = draw_from_all (c);
I of course meant
c = draw_from_all (d);
for the last line.

--
Andrew Poelstra <http://www.wpsoftware.net/projects>
To reach me by email, use `apoelstra' at the above domain.
"Do BOTH ends of the cable need to be plugged in?" -Anon.
Sep 26 '06 #24
Bill Reid wrote:
The real brilliance is coming up with a well thought-out
heirarchy of classes: "Card", "Deck_Cards", "Player", "Dealer",
"Table", etc., for one game (I started with blackjack), then
just reusing them with a "Game" class that uses different
"game rules" to "quickly" model another game (blackjack to
poker, or vice versa), as opposed to just starting over
completely from scratch in C.
While I don't disagree that an OO language lead to some very useful
programming idioms, I do strongly disagree with the notion that C cannot
be written in such a way as to have reusable modules.
Sep 26 '06 #25
Bill Reid said:

<snip>
The real brilliance is coming up with a well thought-out
heirarchy of classes: "Card", "Deck_Cards", "Player", "Dealer",
"Table", etc., for one game (I started with blackjack), then
just reusing them with a "Game" class that uses different
"game rules" to "quickly" model another game (blackjack to
poker, or vice versa), as opposed to just starting over
completely from scratch in C.
Ever heard of "libraries"?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 26 '06 #26
Bill Reid wrote:
As somebody who's actually done this in both languages, I can
say this is much better accomplished in C++ than C, because C++
is "object-oriented".
If you really want to change the subject from C to another C-related
language, I want to change it to Objective-C where I'm living these
days, not C++.

Whether the OP wants to do C++ or not is up to him, but this is comp.lang.c.

I participate in other newsgroups where other languages are topical.
Sep 26 '06 #27
Andrew Poelstra wrote:
In C you can "emulate" OO, and IMHO, this is actually clearer
in a lot of situations. In this case I wouldn't care either way:

Deck d = new Deck;
d.Shuffle();
Card c = d.drawFromAll();

As opposed to:
Deck d = create_deck();
Card c;
shuffle (d);
c = draw_from_all (c);
You can do better than that.

struct Deck {
struct card (*drawFromAll)(struct Deck *self);
/* ... */
}

struct card deckDrawFromAll(struct Deck *self) {
return self->somecard;
}

struct Deck newDeck(void)
{
struct Deck ret;
ret.drawFromAll = deckDrawFromAll;
return ret;
}

int main(void)
{
struct Deck mydeck = newDeck();
struct Card mycard = mydeck.DrawFromAll(&mydeck);
// etc
return 0;
}

:-)

Tom

Sep 26 '06 #28

"Spiros Bousbouras" <sp****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Malcolm wrote:
>"jmcgill" <jm*****@email.arizona.eduwrote in message
But I don't see how it takes more than a few days to actually "Learn
the
C language." It's not that complex a grammar.
A bought a book on C++ in Leeds, and took the bus to Bradford. I read it,
and by the time the bus had arrived, I knew C++.
That is to say, I knew all the keywords and what they meant, I knew how
to
declare clas hierarchies, I knew the quirks like overloaded operators.

How long does the bus from Leeds to Bradford take ,
about an hour ? Books on C++ tend to be hundreds
of pages long ; if you managed to read hundereds of
pages within 1 hour then you're a very talented person.
Did you also read and understand all the code examples
the book had ? Even without that it is still an amazing feat.
Did you remember a few days afterwards the meaning of
all the keywords ? If yes your memory is impressive.

I suspect different people mean different things by "learn"
in this thread. But I don't know how to make it more concrete.
Personally I can't imagine in my wildest dreams learning C in
a few days.
An hour or so.
Enough time to leaf through a book and learn five or six keywords and the
essentially simple idea of object-orientation. Of course I already had
considerable experience of computer programming.

I went to Oxford, and one of the things Oxford teaches you is not to mess
about when material needs to be learnt. For instance on my first day we were
invited in for a chat and some sherry, and asked about our journeys. Then it
was "and O, by the way, ladies and gentlemen, essays on Tennyson by the day
after tomorrow, if you wouldn't mind." Most of us hadn't read a word of his
poetry. So we had to go into the library and get something down on paper.
Most people don't have that. But it is not a superhuman feat by any stretch
of the imagination. It shouldn't take a long time to learn a programming
language.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Sep 26 '06 #29

Tom St Denis <to********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Andrew Poelstra wrote:
In C you can "emulate" OO, and IMHO, this is actually clearer
in a lot of situations. In this case I wouldn't care either way:

Deck d = new Deck;
d.Shuffle();
Card c = d.drawFromAll();

As opposed to:
Deck d = create_deck();
Card c;
shuffle (d);
c = draw_from_all (c);

You can do better than that.

struct Deck {
struct card (*drawFromAll)(struct Deck *self);
/* ... */
}

struct card deckDrawFromAll(struct Deck *self) {
return self->somecard;
}

struct Deck newDeck(void)
{
struct Deck ret;
ret.drawFromAll = deckDrawFromAll;
return ret;
}

int main(void)
{
struct Deck mydeck = newDeck();
struct Card mycard = mydeck.DrawFromAll(&mydeck);
// etc
return 0;
}
Ah, yes, you're getting closer to C++ here, nice use of a function
pointer within the structure, very good...

Actually, though, the "deck" doesn't "draw" from itself, the "dealer"
does. The "deck" is just mostly an array of "cards" with fewer remaining
cards as they are dealt "from the top" (we're not modeling "cheating"
here...yet). Can you make a "Dealer" struct that is a "friend"
of the "Deck" struct that is the only struct that is allowed to access
the "Deck" depletion function?

---
William Ernest Reid

Sep 27 '06 #30

Richard Heathfield <in*****@invalid.invalidwrote in message
news:v6********************@bt.com...
Bill Reid said:

<snip>
The real brilliance is coming up with a well thought-out
heirarchy of classes: "Card", "Deck_Cards", "Player", "Dealer",
"Table", etc., for one game (I started with blackjack), then
just reusing them with a "Game" class that uses different
"game rules" to "quickly" model another game (blackjack to
poker, or vice versa), as opposed to just starting over
completely from scratch in C.

Ever heard of "libraries"?
I think so...ever hear of "inheritance"?

Look, judging from the response, I sorry I brought up the C**
language. I myself have not "abandoned" C in favor of C++ for
everything, because there is a lot of stuff that can be done quicker
(and better) in C. I actually am predisposed to writing in C
when possible because all the extra typing required in C++
aggravates my incipient carpal tunnel syndrome...

However, some of OO "extensions" provided by C++ can be
very useful for certain types of projects, that's all. Sure you can
emulate a lot of this stuff in C (C++ was originally a preprocessor
extension of C), but that's true of a whole bunch of other stuff
too, and there does a come a point of just asking yourself, "Why
am I re-inventing the wheel here, especially since the wheel
is just a matter of naming my files *.cpp..."

---
William Ernest Reid

Sep 27 '06 #31
Bill Reid said:
>
Richard Heathfield <in*****@invalid.invalidwrote in message
news:v6********************@bt.com...
>Bill Reid said:

<snip>
The real brilliance is coming up with a well thought-out
heirarchy of classes: "Card", "Deck_Cards", "Player", "Dealer",
"Table", etc., for one game (I started with blackjack), then
just reusing them with a "Game" class that uses different
"game rules" to "quickly" model another game (blackjack to
poker, or vice versa), as opposed to just starting over
completely from scratch in C.

Ever heard of "libraries"?
I think so...ever hear of "inheritance"?
Sure. But you don't need C++-style inheritance just to play a different game
of cards.
Look, judging from the response, I sorry I brought up the C**
language.
Given that the subject line is "learn me c", I think you're wise to be
sorry. :-)
<snip>
I actually am predisposed to writing in C
when possible because all the extra typing required in C++
aggravates my incipient carpal tunnel syndrome...
That in itself is significant. Me, I don't have incipient carpal tunnel
syndrome. But then, I hardly ever use C++.
However, some of OO "extensions" provided by C++ can be
very useful for certain types of projects, that's all.
Not in comp.lang.c they can't. If you want to discuss C++, there's a dirty
great newsgroup just down the corridor where they like nothing better.

Sure you can
emulate a lot of this stuff in C
Er, no thanks. I have no desire to emulate carpal tunnel syndrome. :-)

(C++ was originally a preprocessor
extension of C), but that's true of a whole bunch of other stuff
too, and there does a come a point of just asking yourself, "Why
am I re-inventing the wheel here, especially since the wheel
is just a matter of naming my files *.cpp..."
Um, the wheel was already invented. C++ simply painted it a new colour, and
its advocates insist that the new colour is the only "right" one - which is
silly.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 27 '06 #32

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

Similar topics

17
by: Rob | last post by:
i know javascript, vbscript, asp css and alot more and im only 14 i was wondering which is easier to learn php or cgi. any help?
42
by: Bicho Verde | last post by:
I have now free time and money to do what I want :-) I have some basic skills in programming (C, Pascal, Macromedia Actionscript) but don't know exactly what to do in the world of programming. And...
55
by: Elijah | last post by:
I have read many of the topics on learning C++ or Java first. It seems like everyone says something different. I would like to know if I should learn C++ or Java. First a little about myself. I...
30
by: Rhino | last post by:
I am giving some thought to applying for some jobs that want people with Java and C++ experience. I have been writing Java for several years and am fluent enough that I don't have to get help with...
8
by: Hermawih | last post by:
Hello , I want your opinion about this . In order to say it clearly , I think I have to describe it in long sentences . I could consider myself as Intermediate/Advance Access Developer ;...
21
by: TAM | last post by:
Hi, I read that ASP.NET uses VB.NET instead of VBScript. I also read that ASP.NET is a subset of VB.NET. So if I learn VB.NET first then do I have the knowledge for programming ASP.NET...
85
by: abhi | last post by:
hi everybody am new to this group and help me to learn C
34
by: pandit | last post by:
hai all, i want to become a good programmer. one of my friends ( named "arnuld", he posts here infrequently), taught me Lisp. so i am not a programming beginner. i have heard these 2 points....
65
by: Chris Carlen | last post by:
Hi: From what I've read of OOP, I don't get it. I have also found some articles profoundly critical of OOP. I tend to relate to these articles. However, those articles were no more objective...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.