# Help me learn C language



## baccilus (Dec 20, 2007)

I am a student of microbiology. For some reason, C language is included in our syllabus. I need your guidance regarding these things:

1. Which online/offline book to consult
2. How do I practice it in my linux box? I have gcc installed but I don't know how to bring it up or start working on it like sir was while demonstrating it on turbo c++ software on windows.

Please consider that I am a medical student and would also need to know about the basics like _what's a compiler,what's a LLL, Hll, _etc.

I think I should have posted in programming section. Sorry about that. Can someone move this please? 

I also saw a post regarding alternative to turbo c but I still need answers to both my questions since I am a complete noob and I have different requirements.


----------



## cool_callis (Dec 21, 2007)

i will suggest u following book for beginning
1.c primer plus      
2.c in a nutshell
   both r really very good books .get hard copy of ny one which is available .
once u have mastered basics for perfection u can follow
1. c programming language by dennis ritchie (creator of c language)
     the best c book but u will not understand this if u first read this book.
c in a nutshell book has given complete detail on compiling and debugging


----------



## QwertyManiac (Dec 21, 2007)

To use GCC, open terminal and do this to compile your written C file:

```
gcc <filename_of_program>.c -o <somename_for_output_file>
```
And once compiled successfully by the above command (No o/p == Success), do this to run the program:

```
./<somename_for_output_file>
```


----------



## baccilus (Dec 21, 2007)

Will these books have the kind of basics that I am gonna need. I need basic definitions and explanations too. How about Balaguru Sami or Nitin Upadhya's book? My friend has them so I won't have to buy them. Are they any good?


----------



## cool_callis (Dec 21, 2007)

if u need only basic knowledge then u can follow balaguruswamy or book by yashwant kanetkar (let us c)
as u need only basic knowledge i suggest that 'let us c ' by yashwant kanetkar will be the most suitable book for u . i has very simple language and suitable for noobs to programming and those who need only basic knowledge . get this book.it has simple language nd easier to understand than balaguruswamy book.


----------



## anantkhaitan (Dec 21, 2007)

QwertyManiac said:
			
		

> ```
> gcc <filename_of_program>.c -o <somename_for_output_file>
> ```


Better include -W for the warning(s): 

```
gcc -W <filename_of_program>.c -o <somename_for_output_file>
```


----------



## praka123 (Dec 21, 2007)

@baccilus are u good in math  I am not and i struggle with programming,still dont know anything even with C although i passed exams long back 9 yrs ago


----------



## Pathik (Dec 21, 2007)

baccilus said:
			
		

> Will these books have the kind of basics that I am gonna need. I need basic definitions and explanations too. How about Balaguru Sami or Nitin Upadhya's book? My friend has them so I won't have to buy them. Are they any good?


Try Kernighan & Ritchie.


----------



## The_Devil_Himself (Dec 21, 2007)

balagurusamy's and kanitkar's are good for nothing.


----------



## hayabusa_ryu (Dec 21, 2007)

I suggest that u should go for *C : The Complete Refrence* published by Tata McGraw Hill and then go for *C : How to program* written by Deitel & Deitel published by Prentice Hall and lastly go for *C The Programming Language *by Ritchie and Kernigham. You can also try Yaswant Kanitkar's book


----------



## anantkhaitan (Dec 21, 2007)

Programming in ANSI C, E Balagurusamy is quite good..


----------



## baccilus (Dec 21, 2007)

@Praka: I am a medical student. I suck at maths. 

I think I will give Balaguruswamy a try first since I won't have to buy it. If I don't understand it, I will go by Hayabusu's advice although I will just read one of them (Have to focus more on my majors, C is subsidiary)

By the way I have installed Anjuta. That's good right?

@Devil: Can you elaborate please.


----------



## Indyan (Dec 21, 2007)

I would reccomend Balaguruswamy and Let us C to start with.
Let us C is very well written and is actually a fun read.


----------



## praka123 (Dec 21, 2007)

@baccilus:yeah Anjuta IDE is very nice and easy


----------



## The_Devil_Himself (Dec 21, 2007)

Indyan said:
			
		

> I would reccomend Balaguruswamy and Let us C to start with.
> Let us C is very well written and is actually a fun read.



please,please don't misguide!!it takes a lot of time to get over the 'kanetkar syndrome'.


@baccilus:I don't think you need any IDE for basic programming,just use a siple text editor and then use gcc to compile,as simple as that.

One humble request,get a good book instead of even trying balagurusamy,I have thsi book and it sucks! some good book will make learning c a pleasure like it should be.


----------



## praka123 (Dec 21, 2007)

I bought long back C for Dummies.it is lieing here in my room.it follows instructs for turbo C which i dont use.but id have to say-it is very easy if u have time though.


----------



## baccilus (Dec 22, 2007)

Devil; I think I will flip the pages a bit and see how he has tried to explain the things. Personally I too like books where author tries to make things simple, rather than throwing knowledge at you. Any book you think is nice and simple which manages to get the concept across?



I can also get "let us C" from Brit library I guess. Will see these and get back to you guys. 



Thanks for the help guys.


----------



## gary4gar (Dec 22, 2007)

get yourself a copy of K&R, it comes for 90 or 100 bucks


----------



## damnthenet (Dec 23, 2007)

Balagurusamy ought to be enough for a addied paper


----------



## MetalheadGautham (Dec 23, 2007)

I noticed that Dev C++ has a built in instruction set for C programming. My friend, who is in this forums, but has not yet posted, has learnt C exclusively through Dev C++'s built in help.


----------



## Faun (Dec 23, 2007)

hayabusa_ryu said:
			
		

> *C : How to program* written by Deitel & Deitel published by Prentice Hall


ftw


----------



## Yamaraj (Dec 23, 2007)

Anyone recommending Kanetkar books should be hanged and fed to vultures.

C Primer Plus is an excellent text. K&R is tough on beginners, and was originally meant for programmers not familiar with C. Stephen Kochan's Programming in C, 3rd edition is also quite good for starters. I also recommend A Book on C by Kelley and Pohl.


----------



## Faun (Dec 23, 2007)

Yamaraj said:
			
		

> Anyone recommending Kanetkar books should be hanged and fed to vultures.
> 
> C Primer Plus is an excellent text. K&R is tough on beginners, and was originally meant for programmers not familiar with C. Stephen Kochan's Programming in C, 3rd edition is also quite good for starters. I also recommend A Book on C by Kelley and Pohl.


I never learned from Kanetkar, 

K & R is for hardcore sys programming

Deitel and Deitel is a good option (includes a primer to C++ and JAVA).


----------



## MetalheadGautham (Dec 23, 2007)

there is a book on C programming by Dennis Ritchie. It is absolutely amazing, even for n00bs. He explains every concept, and gives lots of tips. His english is also scholary.

PS: for those who don't know, *Dennis Ritchie invented C*


----------



## praka123 (Dec 23, 2007)

...and co-invented UNIX for which *C* Programming Language was made.


----------



## gary4gar (Dec 23, 2007)

but a word of caution K&R is book for those who already know some programming in any langage. n00bs will find difficult to understand.

the as the opening text of book is
"_there is no other to learn to program, then to program itself, so lets get started_"

```
#include<stdio.h>
int main()
{
printf("hello world \n");
return 0;
}
```

so the book is closer to *UNIX, so windows wienies may not understand some *UNIX related concepts, like the file system handling etc etc*farm3.static.flickr.com/2134/2122604649_e2f8e1a9b0_o.png


----------



## praka123 (Dec 23, 2007)

books are not responsible atleast 20%!there is no change if u collect these books!make sure u have a good lecturer,guide.with pupils poor in Maths,they sure need a lecturer for C programming etc.no self studying.
best way to learn programming is to make sure whether ur nice in Math or not.i ur not good in math(<60%) then Programming can be left for those geeks and you can try some good with politics  or arts etc 
ofcourse no offense meant to any!JFYI 
^...@gary:waiting for ur fast track to C programming


----------



## adi007 (Dec 24, 2007)

Yamaraj said:
			
		

> Anyone recommending Kanetkar books should be hanged and fed to vultures.


^^please tell why??
though i have not learned C by it but i found it *ok*...

there are lots of downloadable e-books regarding programming languages at
www.freeprogrammingresources.com/books.html
but i personally feel that no e-book can replace the good old normal books..


----------



## gary4gar (Dec 24, 2007)

wise man said:
			
		

> All books by Yashwant Kanetkar including books like Let US C, Working with C, Data structure through C. The problem with his books is that, though they are easy to read, but they contain lots of factual errors. They do not address the fact that certain aspects of C is implementation dependent.



one word:*AVOID THEM*



			
				praka123 said:
			
		

> ^...@gary:waiting for ur fast track to C programming




oh didn't read this....lol i can't code anything properly apart from "Hello world" program
do you need to fast track to hello world


----------



## Yamaraj (Dec 24, 2007)

adi007 said:
			
		

> ^^please tell why??
> though i have not learned C by it but i found it *ok*...


You also find TC++ *ok*. I came, I saw, I detested. And I won't explain why.


----------



## baccilus (Dec 25, 2007)

Any views on Nitin Upadhyay?


----------



## baccilus (Jan 8, 2008)

Ok guys.... I just came across " C-Primer Plus" by Stephen Prata. I have just read the introductory chapter and found it quite interesting. Now how is this book?


----------



## praka123 (Jan 8, 2008)

^good reviews for that book;afaik yashawantha kanitkar's Let Us C also have above book as referral.use gcc or any ANSI/ISO compliant compilers for testing.


----------



## QwertyManiac (Jan 8, 2008)

Will you be just searching for books and not go on with C really at all? By now you should have become a master in its basics, like writing to a file and all!


----------



## baccilus (Jan 8, 2008)

LOL... Ya I am learning it too. Can already write basic programs like asking for name, age, class and masks and then displaying them. But had been learning from computer sir till now. I am using Anjuta IDE by the way.

Guys I am finding it more interesting than my major subject( Microbiology), probably because I am still studying the easy part.


----------



## praka123 (Jan 8, 2008)

^yeah a possible Math phobia case like me  if ur weak in programming that is!(i am!) u may be very much intelligent but fears from math or programming,this is Math Phobia


----------



## baccilus (Jan 15, 2008)

I have been learning C from the past few days and am loving it. 

I have recently started getting into a problem with my anjuta IDE compiler in linux.
 There are several header files it doesn't find. I learn to write some program in the class(windows) but can't run it at home on my linux box. From the errors it seems that I don't have "iostream.h" and "conio.h" header files. How can I install them?

I just realized that I don't have most of the header files. I tried to execute some programs given in this forum but none executed because of some header file or other.


----------



## 2kewl (Jan 15, 2008)

*C & DS by E. Balagurusamy* is a good one to start off with


----------



## baccilus (Jan 15, 2008)

What about the header files problem?

By the way I have decided to go for C primer plus. Am already reading an *ahem* version. Will buy it soon 

But do something about the header files problems. Its really irritating


----------



## QwertyManiac (Jan 15, 2008)

Conio.h is Turbo exclusive (Platform Dependent - Windows).

To include iostream, in standard C++, use:

```
#include<iostream>
```

No .h's.


----------



## baccilus (Jan 15, 2008)

Didn't help..... Still giving syntax error telling that no such file found.

OK... I found the problem.... I was using the extension of .c rather than cpp.  Also I wasn't supposed to use .h extension (as told to me by QM.)

I am supposed to learn C. Now won't this be a bit problematic for me..... I mean using C++'s rules?


----------



## mehulved (Jan 15, 2008)

You have c++ libraries installed?


----------



## baccilus (Jan 15, 2008)

@mehulved


baccilus said:


> OK... I found the problem.... I was using the extension of .c rather than cpp.  Also I wasn't supposed to use .h extension (as told to me by QM.)
> 
> I am supposed to learn C. Now won't this be a bit problematic for me..... I mean using C++'s rules?


----------



## mehulved (Jan 17, 2008)

Sorry I misread. All Qwerty's fault 
There's no iostream in C AFAIK, iostream is part of C++.
To check again, I tried some searches on google but I get -ve for it.


----------



## QwertyManiac (Jan 17, 2008)

Lol yeah, I just noticed my fault too!

Use stdio.h, why did you even include iostream? Which book's nonsense is this?


----------



## mehulved (Jan 17, 2008)

QwertyManiac said:


> Use stdio.h, why did you even include iostream? Which book's nonsense is this?


I dobut it's a book. Looks more like an ignorant teacher's fault or maybe a book on TC.
And you're just reaching 5K posts


----------



## °K£l†huzaD° (Jan 19, 2008)

MetalheadGautham said:


> I noticed that Dev C++ has a built in instruction set for C programming. My friend, who is in this forums, but has not yet posted, has learnt C exclusively through Dev C++'s built in help.



Thanks for mentioning that GT. Dev c++'s built in help file is very useful but at the same time does not cover the entire c language deeply. Its just for newbies who want to get their feet wet.


----------



## MetalheadGautham (Jan 22, 2008)

°K£l†huzaD° said:


> Thanks for mentioning that GT. Dev c++'s built in help file is very useful but at the same time does not cover the entire c language deeply. Its just for newbies who want to get their feet wet.


Dev FTW... btw, just see the wikibooks ebook on C, C++, Perl and Python. They are even better than Dev-CPP


----------



## dsuresh (Jun 3, 2008)

c online tutorial 
*www.cs.cf.ac.uk/Dave/C/


----------



## mastermunj (Jun 3, 2008)

haha... i believe he won't need any book if we all are gonna teach him 1 topic of C here on forum.. lol


----------



## gary4gar (Jun 3, 2008)

Did you try Using Geany?
Its very much user friendly


----------



## sourav123 (Jun 3, 2008)

Is there any book that teaches using GCC? I learnt C 4 years back in University, and that time I was using Windows. I would like to go over it again using Linux and GCC.


----------



## gary4gar (Jun 3, 2008)

No need to follow GCC, Just follow the Standard
Take any book Like K&R which follows the ISO C99 standard, you would do fine


----------



## sourav123 (Jun 3, 2008)

gary4gar said:


> No need to follow GCC, Just follow the Standard
> Take any book Like K&R which follows the ISO C99 standard, you would do fine



I know that. But actually I wanted to know all the GCC functionalities also besides writing the C code.


----------



## mehulved (Jun 3, 2008)

sourav123 said:


> Is there any book that teaches using GCC? I learnt C 4 years back in University, and that time I was using Windows. I would like to go over it again using Linux and GCC.


You want to know about C programming using gcc? Then refer to any good book on standard C programming.
If you want to know indepth about gcc then check it's online documentation *gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/


----------



## Garbage (Jun 3, 2008)

sourav123 said:


> I know that. But actually I wanted to know all the GCC functionalities also besides writing the C code.


And there is a book named *"The Complete Reference to GCC"*. I has this eBook.


----------



## gary4gar (Jun 3, 2008)

Try command "man gcc"


----------



## hjpotter92 (Jun 6, 2008)

Though Harry Potter doesn't need to have any problems regarding C++. He uses his wand for that, butI am not Potter so I need some help for that purpose. I have attached a file which may be extracted and the extension should be changed from txt to cpp and try it in the blue screened TC. i am facing more than 25 errors in it.


----------



## dheeraj_kumar (Jun 6, 2008)

^^ Dude bad archive?

And by the way, HP solves problems not because of his wand, but because of his automatic debugger(Hermione)


----------



## hjpotter92 (Jun 7, 2008)

Does he? really, then think about the fight b/w Voldemort and him. He didn't use her but fought alone. And as for the exams, he can't cheat the pen are cheating proof. 





> The archieve is all right. I downloaded it once more to check it.


----------



## dheeraj_kumar (Jun 7, 2008)

Well she solves lab problems... Voldemort was final exam so couldnt help 

Strange.. WinRAR says unknown archive format...


----------



## hjpotter92 (Jun 9, 2008)

It is realy funny. But it does downloads and works well on my sys.


----------



## mehulved (Jun 9, 2008)

Doesn't open for me either. Try to use some pastebin like rafb.net/paste


----------



## abhinandh (Jun 15, 2008)

nor does it work for me.


----------



## hjpotter92 (Jun 15, 2008)

Ok its is really funny. Try this out: It must work
*willhostforfood.com/users/hjpotter92/Crar.png


----------



## mehulved (Jun 15, 2008)

Why can't you simply use a pastebin, it makes things so much eaiser for everyone.

Anyways, I can't check since it's not C++ but Turbo C++.


----------

