C or C++

Should I learn C or C++?

Definitely.

both

C is deprecated and only useful if you are maintaining Linux shell tools.

Learn C++ or something higher like C#/Python.

I'll take "Things pajeets say" for 500, Alex

>C is deprecated

But which I should learn first?

C.

...

>C is deprecated
How to spot a pajeet 1.1

You'll learn C if you start with C++. Compiling C code in a C++ compiler yields no issues.

Local shitposter goes full retard
More news at 11

int *foo = malloc(sizeof(int)*5);

Compile this as C++ if you're so great.

yeah, what libraries are being opened?

This is getting interesting

I'm waiting

Learn C++ first.

C++ is not != C+classes - learning C first will give you this impression

I'm a pajeet and in my first year we learn c and Python.

>int *foo = malloc(sizeof(int)*5)
Just modified it to int *foo = (int *)malloc(sizeof(int)*5);

What's the problem, not being able to access generic pointers?

You must be confused my friend. We learn C very early within our Indian university system. In-fact I would say Java is less popular than C within our academics.

>Indian academics
Physics 100: You are on 9th floor. Calculate the momentum transferred from your poo hitting a muslim guys turban below (assume he is 1.6m tall)

C is wonderful
C++ is literally worse than putting your dick in a toaster

>muslim guys turban

Did you get offended, ahmed?

struct nigger
{
void *data;
template
operator T*() { return (T*) data; };
};
#define malloc(x) nigger{malloc(x)};

...

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
UP VAR!!1
VISIBLE VAR
IZ VAR BIGGER THAN 10? KTHX
IM OUTTA YR LOOP
KTHXBYE

I can haz unfunny dated maymays???

It is like some saying to you:
>Hahaha! Americans! Do you want to eat some more snails? Do you want to surrender to Germany again? Are you as tall as Napolean? Hahahaha, Americans!
It is easily understood that the intention is to try and embarrass/insult, but your aim is a little bit off.

Learn Java and c# it's easy

begone pajeet

outdated memes are not funny

Just use any language that doesn't force OOP down your throat.

So much this but all jobs as I have seen are in OOP ;_;

OOP is an important part of modern programming.

I'm french and I feel offended, please apologize

REEEEEE

Depends on what you want to do.
Learn both, programming is one of the easiest things you can dive into. Even a lot of people on Sup Forums do it and they are retards.

>I'm french
Hasta la vista! Put some more chipotle on the burrito, hombre!

Ok we get your point.
It's not funny anymore

>macros
#include

namespace cfunc {
extern "C" {
void *malloc(std::size_t size);
}
}

namespace muhmalloc {
struct nigger {
void *data;
template
operator T *() {
return (T *)data;
}
};
auto malloc(std::size_t size) { return nigger{cfunc::malloc(size)}; }
}

using muhmalloc::malloc;

int main() {
int *foo = malloc(sizeof(int) * 5);
return 0;
}

Hey, I never realized you could link a function into a namespace like that. That's cool. I guess it only works for extern "C" functions?

i thought it was pretty funny

I don't know, I only found it now. I just wanted a macroless implementation and it happened to work. Honestly, I don't even know if it's legal or not. clang and g++ doesn't complain.

both

Honestly, you could learn them just for the history and to get a deeper knowledge of how computers work, but there isn't really any practical reason to learn C or C++ at this point.

If you're starting out now, you should learn modern languages. C and C++ are old and obsolete at this point. Rust replaces them for low-level systems programming, and other languages like Go and C# cover high-level programming.

holy shit go back to pol

Saved.

C of course. C++ is obsolete and it's a disease.

>"""""""learns""""""" C in school
>thinks he knows C
wake up pajeet. knock knock

c very well then c++ very well

>imblying it's possible to learn C++ very well

Gee, I wonder?


>C
-learn syntax in one week
-learn tooling in one more week
-write perfectly understandable code
-writing C code generators is easy
-use C via FFI in many high level languages like Haskell, Python, Ruby, Lua and many more
-C always comes in handy, even if you don't really use it every day

>C++
-learn the basic syntax in one year
-learn tooling in months
-write cryptic and complex code
-nobody likes C++, except C++ users
-writing C++ code generators brings no advantage to C code generation
-C++ is a "do or die", either you are extermely good and find a C++ job or nobody will care

>should I learn how to ride a bike or how to do sick 360 flips on my mtb first?

c

c++ is a meme

So I typed this out in C and I got 6118896.
I looked up Malloc, why would you need This? Why would I need to take a big chunk of memory?

user stop trying if you dont know c

I don't know if this is bait or not..

Maybe look up C pointers?


#include
#include

int main(void) {

int *foo = malloc(sizeof(int)*5);

// prints the memory adress where the pointer is pointing to (something like "21143568")
printf("%i\n", foo);
// prints the value of the memory adress where the pointer is pointing to (0)
printf("%i\n", *foo);

free(foo);
return 0;
}

Learn to suck robot dick because programming will be obsolete when robots take over

AND WHO WILL PROGARMM THOSE ROBOTS?!?!

>inb4 muh singularity

>Should I learn C or C++?
Depends entirely on what you want to do. In most cases C++ is better. Far more jobs in it.

The singularity will

It doesn't matter. One will make it easier to learn the other anyway.

int *foo = (int*)malloc(sizeof(int)*5);


??

Integer pointer foo = (typecast to integer pointer) allocate memory (five times the size of an integer)

>int *foo
Why do people write this? Do they interpret * as part of name? It's unreadable.

C is just so intuitive. Need to make a variable-sized list of strings? Easy:

#include
#include

int main(int argc, char *argv[])
{
char **foo = malloc(sizeof(char *) * argv[1]);
for (int i = 0; i < 10; i++)
{
foo[i] = malloc(sizeof(char) * argv[2]);
}

return EXIT_SUCCESS;
}

Change 10 to argv[1]

Can't tell if he's sarcastic or not

Is C# really used that often? How does it differ from C++ and C that makes it better? Also, how I'd it any better than Java?

Assuming you don't know any programming because you're asking this dumb question - I'd do C first because
1.) you learn memory management
2.) you can't BS shit, you have to know what's going on and understand your code(due to that last part)
3.) if you try to learn C after you've done a higher level language like Python or even java or c++ you'll think "I can't even add two strings together without thinking for more than a few minutes whereas in python or java it's just "i love" + "dick", fuck this dumb shit"
4.) with that last point you'll be thankful and more appreciative for every other language you learn because most higher level languages (in my opinion) have more features and are therefore more convenient

It's a lot like java, but has more features like delegates which make you copypaste stupid patterns less. It also is less restrictive about exception handling, it won't force you to copypaste stupid placeholders for catching exceptions you know will never occur. .NET's API is also more consistent and less buggy, the syntax has more sugar too (Lately Java started to get same features present in C# but it lags behind 4 years or so). C# also allows easy use of references and non-managed memory, tools for marshaling, etc. It's easy to wrap C++ code with C++/CLI and use it from C# projects too.

The main problem is microsoft. It sucks. It's actually quite surprising they managed to make such a good language. They also tend to kill of their projects like they did with silverlight or windows forms. I don't know if WPF is still alive but I guess it's about time it gets deprecated as well. Apparently nowadays C# is only used by web developers for ASP/.NET and students.

Because C declarations are fucked up and that really is how it is parsed?

Java 8 was three years ago senpai, you can end your ignorance now.

So you can't actually use int* foo in C?

This is the new retard thread?

int* foo, bar;
This doesn't do what you think it does.

So you mean foo isn't a pointer and bar isn't in integer?

his point is that the * couples to foo rather than to the type

and by using
type* var;
instead of
type *var;
you're alluding to it being otherwise

Oh so maybe in 3 more years we'll finally see optional arguments in Java 10.

Why are you arguing with someone who agrees with you?

You have overloads, make your own.

Oh right, that's why I never use commas in declarations.
I wonder if this nonsense ever gets fixed. Probably not. Most likely.

>caring about niggers
Go stone a faggot, Muhammad

C has some really shitty design decisions, it's telling that no language since has repeated these blunders.

C++ did though. STL is quite fucked up too.

C++ did because it wanted moderate source level compatibility with C. New languages without such requirements e.g. D drop it, because it stinks.

Both, then outgrow them towards something that isn't an anachronism.

Learn MATLAB if you don't want to be a code monkey.

Are you implying OP is a millionaire, again?

Turns out C was the pajeet language all along.

Well you're posting in it so apparently so

C first

C++ first

>learn the basic syntax in one year
Brainlet please, all the syntax takes max one month to learn.
Also cpp code is less cryptic than c when done well

>c when done well
Regardless, it is surprisingly hard to find good C code.

im 26 and want to learn how to pg roam what should learn first

C++ is a solid programming foundation, once you understand programming fundamentals trough C++ you can easily switch to other simplified / abstract computer languages later on.

If time is a concern, learn python / java / c# - but trough professional guides, books that cover principles / computer science.

I want to make bideo game.

I'm currently trying to learn c++ from cpp.com

>C++ is a solid programming foundation
>this is what sepples monkeys actually believe