Newfag here. What do you guys think the best book for learning C?

Newfag here. What do you guys think the best book for learning C?

>inb4 C the programming language

Other urls found in this thread:

amazon.com/Programming-Rust-Fast-Systems-Development/dp/1491927283
informit.com/articles/article.aspx?p=30303&seqNum=2
twitter.com/AnonBabble

The standard.

reddit.com/r/programming

This book:
amazon.com/Programming-Rust-Fast-Systems-Development/dp/1491927283

Why do you wanna learn C, dude? Are you new in programming world?

need to learn it for work

Your pic.
Not even memeing.

i was looking for a different book

C is a disservice to intelligent programmers. It has almost 0 features that a modern and intelligent programmer uses to be productive. Since C is such a timesink, it's popularity is falling more than any other languages in the market.
C is dying and it should die ASAP. C programmers are actually retards in general. C is a small language to grasp, exactly the kind of shit that makes things retard friendly.
C has no advanced features like C++ does.

But as a newfag you are kinda in the right direction. C is for newbies. Think of it this way:
During ancient times, counting to 10 was a big deal and a person who could count to 10 was considered to be "wise".

Fast forward a few century counting to 10 is so trivial we teach this to toddlers. Now toddlers appreciate the vast "knowledge" of counting to 10 while matured brains are busy with modern technologies.

C is from stone age and the people who still preach it is like overgrown toddlers that can't learn advanced things.
C doesn't have delegates
C doesn't have resizable arrays
C doesn't have strings
C doesn't have string concatenation
C doesn't have namespaces
C doesn't have exception handling
C doesn't have closures in the standard
C doesn't have unit tests
C doesn't have Function overloading
C doesn't have memory safety of any kind
C doesn't prevent memory exploits and has no bounds and runtime checks
C doesn't have dynamic method loading/creatin
C doesn't even have generics and templates
C doesn't have meta programming
C doesn't have mixins
C doesn't have higher order functions
C doesn't have contract programming
C doesn't have inner classes
C doesn't have function literals
C doesn't have array slicing
C has a very limited support for implicit parallelism
C doesn't even have string switches

C is a cancer that plagues the modern industry. If you want guaranteed memory exploits and security vulnerabilities in your program with timesink development period then use Assembly, not C.

C is excellent for fairly low level programming and portability. There are billions of people on this planet and not all of them have all of the requirements that you do.
No one is going to write a microwave driver in Javascript.

>resizable arrays
What is a pointer?
>no strings
What is a char array?
>no string concatenation
What is strlcat() strncat() and strcat()?
Also:
printf("string" " " "concatenated);

>no exceptions
setjmp() and longjmp()
>unit tests
Make your own.
>generics
void * is all you need.
>meta programming
AKA making code unusable and unreadable.
>memory safety
>memory exploits
>runtime checks
AKA intelligence

printf("string" " " "concatenated");

Pointers on C by kenneth Reek.

>what is pointer
Not a resizable array
>char array is strings
Yeah, char iteslf is an int from the ASCII table
>printf("string" " " "concatenated");
That's not concatenation operator
string3 = string1~=String2 is string concetanation
>setjmp() and longjmp()
Wso where is try catch and finally blocks?
>Make your own unit test.
How about I use a lanugage that has these already
>void * is all you need.
No I need powerful templates
>AKA making code unusable and unreadable.
A c tard doesn't understand the need of meta programming
>AKA intelligence
100 out of 100 C developers produced hundreds of security bugs with that mentality

C is a fucking Cancer and it HAS to die.

If I need to write a driver I would pick ASM over C any day any time. Why are c tards so afraid of JS when it clearly has it's own niche purpose just like C itself.

Although I would argue that C has no place in the modern world. Either use ASM or C++. C is an awkward uselessness in the middle

C Programming: A Modern Approach by K.N. King.

>what is pointer
>Not a resizable array
Yes it is. You can put a buffer of whatever on the heap and access it like an array.
Another anti-C shill who doesn't know shit about C.
Arrays are pointers.
>char array is strings
>Yeah, char iteslf is an int from the ASCII table
And? A string is an array of char's. Saying that isn't a string is retarded. That is the DEFINITION of a string.
>printf("string" " " "concatenated");
>That's not concatenation operator
>string3 = string1~=String2 is string concetanation
You want operator overloading, not string concatenation. String concatenation has nothing to do with operators you fucking web """"dev"""" trash.
>setjmp() and longjmp()
>Wso where is try catch and finally blocks?
In a cancer wing.
>Make your own unit test.
>How about I use a lanugage that has these already
Please do. C doesn't need or want you.
>void * is all you need.
>No I need powerful templates
AHAHAHAHAHAHAAA
>AKA making code unusable and unreadable.
>A c tard doesn't understand the need of meta programming
Oh I understand it, and that's why I don't want to touch it with a ten foot pole unless I absolutely have to.
>AKA intelligence
>100 out of 100 C developers produced hundreds of security bugs with that mentality
Shitty programmers produce shitty code, no matter what language. (You) being in that demographic obviously wouldn't understand this.

>C is a fucking Cancer and it HAS to die.
You first.

No.
C is a middle ground between ASM and C++.
Kernels fit perfectly here.
Try and maintain kernel with modern features that is also written in ASM.
If you will kill yourself within days.

>Yes it is. You can put a buffer of whatever on the heap and access it like an array.
That's not resizable array. No wonder C has damaged your brain to the point where you do not understand array.allocate(N)
>Arrays are pointers.
Everythig is
>and?
So WHY THE FUCK DO YOU NEED CHARS WHEN YOU GOT MOTHERFUCKING INTS TO REPRESENT CHARS?
>operator overloading
Does it exist in C? Yes?
>try-catch-finally doesn't exist
Because C doesn't have exception handling
>Doesn't know generic programming
Stick to your toddler tier if else while for loops programming, brainlet c tard
>Oh I understand it
No you don't. Because C simply has no meta programming
>Shitty programmers produce shitty code
>Linus is a shitty programmer
I like the mental gymnastics of a backward ass drooling c tard and how angry they get when someone points out what a massive piece of shit C is

>That's not a resizable array
>Everything is a pointer (including arrays)
>pointers can be resized
Nice logic there.
You should get a refund from your Code Bootcamp.
>So WHY THE FUCK DO YOU NEED CHARS WHEN YOU GOT MOTHERFUCKING INTS TO REPRESENT CHARS?
It's shorter.
Kind of like the difference between
char str[] = {'n', 'i', 'g', 'g', 'e','r', '\0'};

and
char str[] = "nigger";

>operator overloading
>Does it exist in C? Yes?
No, and for good reason.
It is abused by shitty programmers to obfuscate code. (You) apparently are a prime example.
>Because C doesn't have exception handling
The behavior can be emulated with setjmp() and longjmp(). Why you want hidden goto's everywhere is beyond me. If you want them so bad don't use C. It's not rocket science.
>Stick to your toddler tier if else while for loops programming, brainlet c tard
For 99.9% of programming that's all you need.
But okay, continue masturbating over your Code Bootcamp certificate.
>No you don't. Because C simply has no meta programming
>implying C is the onlyl anguage I use
No. I use other OOP languages with the """"features"""" you describe and have seen firsthand how they are abused.
>Shitty programmers produce shitty code
>Linus is a shitty programmer
No he isn't, and to wonder what twisted logic you used to imply that I implied this in any way proves your IQ is in the double digits.

Actually although C was my first love, I now am a Javascript developer. I just said you wouldn't use it for a microwave.
Where is all this unfounded hate coming from?
It does have a place, ASM is not good for writing structured programs or for portability.

>char str[] = "nigger";
>shorter
That ain't short, this is short: string = "c tard";
>No, and for good reason.
Yes, C is not growing, it's just a dying tumor. Does it even have lexical closures?
>string1~=string2 is (((abuse)))
Wow, c tard you trully are showing your c tardation.
>For 99.9% of programming that's all you need.
Only if your piece of shit language is an insult to people with IQ higher than 20 it is

Dumb shit c tard just fuck off and cry in the corner while developing your non existent kernel

>C
>Portability
>Good for sturcutes
I think you hit your head pretty bad

C is so simple and void of functionalities it feels like an insult to write C programs

OP here. I didn't know starting a thread like this would cause an argument like this. Regardless, I will learn C and C++ from what I've gathered

ITT: unimportant retards arguing over pointless shit that most career developers don't give a flying fuck about. None of you are the next paragon of software, nine if you will do anything worthwhile or to further the creation of software, you're all nobodies who won't be remembered

Actually, I was referring to structured programming, as in the use of blocks to write code. Assembly language does not use blocks. Check out some articles if you want to know more, it's actually quite interesting.
informit.com/articles/article.aspx?p=30303&seqNum=2
Brainfuck's ancestor was actually written as the first proof that structured programming was Turing complete.

As for portability, I'm referring to the fact that assembly language is architecture specific, whereas C, being a compiled language, is not.

I can see how you'd get confused, what with the popular definitions of these terms.

Not with that attitude!

>Compiled languages are portable
?

I hate to quote wikipedia, but it has a good summary on this:
>Each assembly language is specific to a particular computer architecture. In contrast, most high-level programming languages are generally portable across multiple architectures but require interpreting or compiling.

>his posts get shorter
Topkek
>this is short: string = "c tard";
typedef char * string;

Not that any non-retard would want to do that.
>Yes, C is not growing, it's just a dying tumor. Does it even have lexical closures?
Next standard will.
C will last longer than any of your meme languages.
>>string1~=string2 is (((abuse)))
Wow, c tard you trully are showing your c tardation.
If you can't see how operator overloading can be abused, you probably don't even program.
Don't use C if you want operator overloading.
>Only if your piece of shit language is an insult to people with IQ higher than 20 it is
What is being turing complete?
More seriously, why is the backbone of everything written in C? All your meme language interpreters are written in C, all your meme langauge compilers were written in C at least at first.
Really makes you think.
>look at me im above everyone else because i dont have an opinion xdd

Ignore these ballbags, literally any site these fuckin months mock will point you in a better direction. You want good advice in this? Hit up Reddit
Yeah, that's the issue, my lack of positivity towards this festering cum bucket of a board and cunts that visit it. Thanks doctor Phil was having an existential crisis before you chipped in there

>Yeah, that's the issue, my lack of positivity towards this festering cum bucket of a board and cunts that visit it. Thanks doctor Phil was having an existential crisis before you chipped in there
Forget that, have a better opinion of yourself.

Took you a while to take that damage
>his posts get shorter
what?
>typedef char * string;
-you need a screwdriver to drive the screw in
c tard: ok let me build that screwdriver
normal person: done already

>creating typedef for things trivial as strings
LMAO and this is the c tard that doesn't like meta programming and templates

100 bucks say he'd defend c even if it didn't have macros

>Next standard will.
AHAHAHAHA MAYBE LIKE 25 YEARS LATER WHEN C GOES EXTINCT GCC WILL GET IMPLEMENT "CWHATERVERTHEFUCKYEAR"
>If you can't see how operator overloading can be abused,
That's not "abusing" that's using, you can call the grapes are sour because you can't have 'em

>What is being turing complete?
Brainfuck is turing complete. Fuck off and use brainfuck because anything but brainfuck are bloats

C++ doesn't need C in any cases and neither does D or Rust.

>C is the "backbone"
Because evolution exists. No one uses FORTRAN anymore as much and no one will use C in the near future. LLVM and GCC are already written in C++

Fuck C and your feelings, c tard. Commit suicide with your dying shit languagelet

I've got a great opinion if myself, it's the subhumans who should've been a stain on a mattress that endlessly debate the minutae of C every fucking day on this board that I look down on

You should concern yourself with things you can control then. You will be happier.

Every single time,
Every single fucking time I see C codes I cringe visibly and I feel disgusted enough to puke. C gives me the hardes cringes

I'm happy enough as is, what would elevate me to fucking Nirvana would be less retards like most of those in this thread. It's embarrassing that it's easier and more productive to turn to Reddit for tech discussion than Sup Forums

I was talking about this earlier
>write a program in C that takes any number of arguments as strings, and returns the pointer of the concatenated arguments
C:
#include
#include
#include
#include
#include

char *concat(size_t n, ...)
{
va_list args;
va_start(args, n);

// Find total length of output string

size_t len = 0;
va_list iter;
va_copy(iter, args);

for (size_t i = 0; i < n; ++i) {
const char *str = va_arg(iter, const char *);
size_t n = strlen(str);

// Overflow. Only sensible option is to fail.
if (len >= SIZE_MAX - n)
return NULL;

len += n;
}

va_end(iter);

// Null terminator
++len;

char *res = malloc(len);
if (!res)
return NULL;

char *ptr = res;
for (size_t i = 0; i < n; ++i) {
const char *str = va_arg(args, const char *);

// Using the non-standard (but POSIX standard) stpcpy,
// so we aren't constantly rescanning over the string
ptr = stpcpy(ptr, str);
}

va_end(args);
return res;
}

int main()
{
char *ptr = concat(4, "Hel", "lo, ", "Wor", "ld!");

printf("%s\n", ptr);

free(ptr);
}

as opposed to either def concat(*s): return ''.join(s)
or
import std.stdio;
void main(string[] args){
string result;
foreach(arg; args[1 .. $]){
result~=arg;
}
writeln(&result);
}

God I hate C
SO
FUCKING
MUCH

I can just imagine some fat jobless fuck, who just got through his shitty Code Bootcamp frothing at the mouth with this post.
>-you need a screwdriver to drive the screw in
>c tard: ok let me build that screwdriver
>normal person: done already
Because typing one line, or just typing a few extra characters, is so difficult.
Confirmed for having never programmed anything.
>AHAHAHAHA MAYBE LIKE 25 YEARS LATER WHEN C GOES EXTINCT GCC WILL GET IMPLEMENT "CWHATERVERTHEFUCKYEAR"
You are not making sense here, but people like you have existed for a long time.
C is still here. C is still being used. I'm (not) sorry if that triggers you.
>C++ doesn't need C in any cases
Many functions in C++ come from C you fucking retard.
>neither does D or Rust
AHAHAHAHHAHAHAHA
What is libc.so? Fucking retard.
>C is the "backbone"
>Because evolution exists. No one uses FORTRAN anymore as much and no one will use C in the near future. LLVM and GCC are already written in C++
GCC is more like a C project, it barely uses C++ features, and it was all C not too long ago, bad example.
Most libraries and kernels still use C, and will always use C. Most of your meme languages call out to C or C++ libraries
>Fuck C and your feelings, c tard. Commit suicide with your dying shit languagelet
"No"
Nice copypasta CIA nigger.

>Has a GC
>As a systems language
Dropped

There are 40 posts and 12 posters

It's one guy who's trying to force a meme that C is bad

>Because typing one line, or just typing a few extra characters, is so difficult.
A ctard has to shit all over the source files to hack together operaotr overloading and generics while other people have done their job. Cry harder, autistic fucktard
>You are not making sense here, but people like you have existed for a long time.
There is no lambda or closures in standard c, autist
>Many functions in C++ come from C you fucking retard.
yea, the if while for loops that toddlers limit themselves into
C++ crashes the fuck out of C in every single way possible
>GCC is more like a C project
It's written in C++ and so is LLVM. Keep crying, autistic c tard NEET

wtf I hate C now

The C example has to come from a bad programmer, right? I mean it's pretty bad

>I mean it's pretty bad
Why is it bad?

it looks like too much work in comparison, an unintuitive too

>his posts just devolved into calling me an autist and a c tard
>he's not making any points
Nice talking to you. CIA nigger.
See
>harmful.cat-v.org/software/c++/linus
According to the problem
>write a program in C that takes any number of arguments as strings, and returns the pointer of the concatenated arguments
Why would you use varadic args nigger?
Just iterate over argv.

>Why is it bad?
Because it's fucking C
No, C programs are inherently disgusting and ugly like that

>too much work
In a language where you manage your own memory, that's sort of what you need to do.
Other languages are doing probably dozens of allocations behind your back.
The C example only does 1.
>unintuitive
How? The va_list stuff kind of shits the function up, but that's what has to be done if you're using variable arguments.
It goes through some pretty logical steps:
- Find the length of the string
- Allocate the string
- Copy into the string

>Just iterate over argv.
Let's see your beautiful code, user

>Because typing one line, or just typing a few extra characters, is so difficult.
An absolutely moronic appreciation of programming and engineering in general.

The problem isn't just typing more, the problem is being more convoluted for the sake of being more convoluted, allowing the possibility of bad things to happen for no advantageous reason and the redundancy of going out of your way to do something that can only be done one way.

>C is still here. C is still being used. I'm (not) sorry if that triggers you.
"People are doing it" doesn't mean it's a good idea

It's on the way out, though. We can and will eliminate needless complexity wherever it is, and for good reason.

>It's on the way out, though
Just because you said it, it doesn't mean that it's true.
There is still no viable language for replacing C.

>Find the length of the string
>- Allocate the string
>- Copy into the string
timesink
-get the strings
-join them
-return the joined string's pointer

boo fucking hoo

>join them
Define how this is done.

>he's not making any points
see Idiot drooling autist

>There is still no viable language for replacing C.
Should we tell him?

new string = string1string2

Rust is not a viable replacement for C.
C++ is not a viable replacement for C.
D is not a viable replacement for anything.

i.e. "I have no idea how memory works".

C++ rust and D are more than viable to replace C. Maybe you need to understand this is 2020

What's your point? Why do I need to manage memory myself for doing what I was told to do?

You clearly don't understand C, or why it's popular.
I'm not even going to bother arguing with you anymore. You can't convince the wilfully ignorant.

>Rust is not a viable replacement for C.
It's a C styled language that offers all the control while being safer, is more advanced and is faster

Let's hear how contrived you get trying to justify why it's not a replacement for C

well CIA nigger respond to

>or why it's popular.
Yes people found a better language than FORTRAN

Tell me why I need to manage memory myself to join two fucking strings?

The way you write rust, memory management is an automatic by product, without a GC. It's an upgrade from RAII

The problem could have been solved in a more efficient less retarded way.
This """example""" was coughed up by a CIA nigger.
#include
#include
#include

int main(int argc, char **argv)
{
int i;
size_t n = 0;

if (argc < 2)
return 1;

for (i = 1; i < argc; i++)
n += strlen(argv[i]) + 1;

char *ptr = calloc(1, n);
if (!ptr)
return 1;

for (i = 1; i < argc; i++)
ptr = strcat(ptr, argv[i]);

puts(ptr);

free(ptr);

return 0;
}

Is this the cleanest you can come up with?
Literally NO match for
r

import std.stdio;
void main(string[] args){
string result;
foreach(arg; args[1 .. $]){
result~=arg;
}
writeln(&result);
}

Was that supposed to be more convincing in any way?

C people are really mentally ill

It is much cleaner than I could re arrange a few things to make it look nicer, but if you can't understand what my code does, then you are fucking retarded and should not be allowed near a computer.
It's probably much faster than your D example.

I understand how your shitty toddler ptr trickzz workds, it's not rocket science. Problem is"
a: Your code makes me puke
b: There is no point of managing memory for a function that literally joins two strings
c: C is a fucking timesink

Your code doesn't print a pointer, it prints the joined string

>it makes me puke REEEEE
Okay? Doesn't really matter to me.
>there is no point in managing memory for a function that literally joins two strings
....
You do know that D, Rust, C++ and virtually every higher level language puts strings on the heap right?
>i understand it
>calling it ptr trickz
>not knowing how strings work
>not knowing the difference between the stack and the heap
No you don't lol.
>c is a fucking timesink
That didn't take me that long to make.

see

What a fucking joke.

>it doesn't print the pointer it prints the joined string
Brainlet detected.
You do know what a string is right?
If you want the address then
printf("%p\n", ptr);

CIA nigger.

>dmd
You do realize you use ldc, right?
What the fuck you fucking low IQ autistic trash? It literally prints the string, not the address you dumb fucking retard with chronic down syndrome

>its another anti c shill that goes into a fit of rage when he gets btfo episode

It's still fucking garbage.

Your code prints a fucking string you dipshit c tard see your abomination very carefully

What makes it "garbage", archtoddler?

75 allocations, 4 of them leaked, 60KB memory for such a simple program.
If this is how it handles trivial programs, I don't even want to see how it handles non-trivial ones.

No it deference a pointer to an array of characters.
Try again brainlet.
If you want the actual pointer (why?) see >that disc usage
D: 180K
C: 12K
>that 60kb allocation
>only 1036 bytes allocated for C
Really makes you think.

>60KB memory
What? is that supposed to be satire?

>C doesn't have delegates
>what are pointers to functions?
>C doesn't have resizable arrays
>what is malloc() and free()?
>C doesn't have strings
>what is char *?
>C doesn't have string concatenation
>what is string.h?
>C doesn't have namespaces
>what is scope and not being a retard?
>what is appending a name space tp a variable name if you need it that bad
>C doesn't have exception handling
>what is setjmp() lngjmp() and goto
>C doesn't have closures in the standard
>what is an intentionally small standard with the ability to implement what is needed?
>C doesn't have unit tests
>what is writing your own tests?
>C doesn't have Function overloading
>what is a dangerous "feature" that can be implemented with stdarg.h anyways?
>C doesn't have memory safety of any kind
>what is checking array bounds?
>C doesn't prevent memory exploits and has no bounds and runtime checks
>what are things that have been implemented?
>C doesn't have dynamic method loading/creatin
>what are structs with pointers to functions?
>C doesn't even have generics and templates
>C doesn't have meta programming
>C doesn't have mixins
>C doesn't have higher order functions
>C doesn't have contract programming
>C doesn't have inner classes
>C doesn't have function literals
>what are huge waste of times?
>C doesn't have array slicing
>what is pointer arithmitic and loops?
>C has a very limited support for implicit parallelism
>what are libraries?
>C doesn't even have string switches
>what is making an array of strings, searching it for your string, then switching to the array value?

>Contract programming
>"waste of time"
HAHAHAHAHAHA

>That's not concatenation operator
>if you don;t use my stupid operator you don;t support it
LOL

Fucking brainlet. Can't even properly encapsulate operations into functions.

>No it deference a pointer to an array of characters.
except I asked you for a fucking pointer, dumb shit
Learn how to use a keyboard, dumb c tard

Needlessly complex and roundabout is what it is

>>that disc usage
>D: 180K
>C: 12K
Are you trying to be sarcastic? Who said anything about disk usage?

In the domain that C works in, these kinds of things are important.

Well why is C popular? I actually don't know

>why doesnt this low level language have 30,000,000 functions already preprogrammed inside 50,000,000 libraries and 3,000,000 frameworks like my Java does :((((((((

You know calling a foreach means diving into a bunch of inheritance bullshit and you just have to hope that it was a well written iterator, yeah?

I'd much rather take

int i;
size_t n = 0;
if (argc < 2)
return 1;
for (i = 1; i < argc; i++)
n += strlen(argv[i]) + 1;
char *ptr = calloc(1, n);
if (!ptr)
return 1;
for (i = 1; i < argc; i++)
ptr = strcat(ptr, argv[i]);
puts(ptr);
free(ptr);
return 0;

over
>What exactly is happening behind that foreach?
>gee i dunno, something i guess

>moving the goalposts
The original example prints a string, and that would be the use case, but as I stated previously
printf("%p\n", ptr);

if you want the actual pointer itself
I also hope you know that
printf("%s\n", ptr);

and
puts(ptr);

are exactly the same.

In that domain ASM is both
1: Minimal
2: Takes less resources

IDK why C exists

C_Programming_A_Modern_Approach_2nd_Ed.pdf

>What exactly is happening behind that foreach?
If I cared I could have used while loops, is it too hard to understand for a c tard?

People like having portable code, you know.
Assembly is basically the definition of non-portable.

C is portable asm