r/pascal • • 3d ago

Does the knowledge of Pascal help to understand C better?

People who know both Pascal and C, can you recommend to learn Pascal before C or it is unnecessary today?

23 Upvotes

40 comments sorted by

14

u/ggeldenhuys 3d ago

The syntax will be different, but programming concepts like loops, data structures translate to any language.

5

u/FantasticWait7109 2d ago

As someone who learned programming with Pascal, I did find learning subsequent programming languages (including C and C++) easier as a result, even though the syntax is completely different.

Thinks like structuring code, different concepts, good practices, etc.

4

u/suvepl 3d ago

If you're completely new to programming, then yes, Pascal is an easy language to learn and it'll help you understand basic concepts better.

If you already have some programming knowledge and are looking for some stepping stone or middle ground before plunging into C - I'd say nah, learning Pascal first won't help you much.

3

u/r_sarvas 2d ago

Back in my day, Pascal was used as an introduction to a structured programming language. It was accessible to people that had only ever been exposed to basic before. C was usually the next thing you learned, so it was a logical progression at the time.

These days, there are a ton of language options that were not available then. Pascal doesn't have to be your starting point.

3

u/umlcat 2d ago

Yes, I strongly suggest learn Pascal before C. My College had that learning system.

It laso helped me learn PHP, when C based PHP was a business trend.

And, yes there are several oddities like using case sensitive identifiers.

Additionally, before I learned C, I got Pascal classes, and in my free time, I learned pointers and data structures on my own in Pascal before I got the same topic classes in C. Very helpful.

2

u/CallMeSmithJohnSmith 3d ago

I fully agree.
My personal path : turbo pascal -> turbo C -> turbo C++

Pascal gives you the foundation to be able to safely be confronted to the freedom later given by C

2

u/BenkiTheBuilder 2d ago

Same here, although I skipped C and went straight to C++ (which was a much simpler language back then). Pascal allows one to learn the concepts in a friendlier form than C.

2

u/BenkiTheBuilder 2d ago

I guess my suggestion today would be to learn Object Oriented Pascal and from that learn the subset of C++ that has a corresponding feature in OO Pascal. Other features of C++ can be acquired over the years. I am not ashamed to admit that I have added very little to the feature set of C++ I use today compared to what I learned in the 1990s.

Side note: If you want a custom C++ course/textbook focussed on only the Pascal subset: Ask AI. Filtering information is what LLMs are best at.

1

u/peno64 2d ago

You are old. Turbo Pascal doesn't exist anymore

2

u/gwenbeth 2d ago

The language isn't the point, knowing the programming concepts is the point. Once you understand loops, conditionals, structures, ponters, functions,.and recursion in one procedural language you are already 90% of the way there to knowing any other procedural language. The rest is just learning all the quirks. If you know pascal and look at a c program you could figure out most of what it does pretty quickly. Maybe a few things might throw you off like using a for loop to traverse a linked list or duffs device, but it would mostly make sense.

2

u/ynys_red 2d ago

Pascal and C shared similarities. Sort of words versus braces. C++ arghhhh . . .

2

u/Maqi-X 3d ago

No, pascal is completely unrelated to C

1

u/Dazzling_Music_2411 2d ago

They have similarities, for instance Pascal has pointers too. They have significant differences too, of course.

I am currently porting a book - where the examples are written in Pascal - into C, and it is fairly easy to do even though I never learnt Pascal. Once you work through a few lines of code the mappings from the one language to the other become quite obvious.

1

u/mm007emko 3d ago

Yes. Syntax is of course different but principles are the same.

1

u/suhcoR 3d ago

There are so many Pascal dialects, too many for a general answer. For Wirth's original Pascal: no, it shares some ideas, but only a fraction of scope, and C has a totally different, weird syntax in comparison. If you know TurboPascal, Lisa Pascal, VAX Pascal, Object Pascal, or even the lower levels of FreePascal, then you have seen most features C has, but still the weird syntax (e.g. try to represent an array of procedure types in C and compare it with your Pascal version). So treat them as two different languages and learning paths. Pascal is likely easier for beginners.

1

u/flatfinger 16h ago

I think an array of procedures would be something like:

Var
  MyProcedures: Array[0..15] of ^Procedure(Foo: Integer, Bar: Double);

Some aspects of syntax are better in C than Pascal, but type and variable declarations are not one of them.

1

u/Due-Result7928 3d ago

Can speaking portugese help you to learn chinese ?

1

u/peno64 2d ago

No. The analogy would be, can speaking Portuguese help you learn French. They are derived from the same mother language. Chinese is totally different.

1

u/RevolutionaryRush717 3d ago

Pascal and C are just two variations on imperative, procedural programming.

If you wanted to broaden your mind, look at Lisp for the functional programming.

There are also other programming styles to consider, logic programming in Prolog, or something elde entirely, stack-oriented programming in Forth.

Or APL, which is, er, mathematical?

So explore different programming paradigms first, then you will gain more from different languages implementing the same paradigm like C and Pascal.

1

u/EconomySerious 2d ago

Pascal Will help you to obtain good programing habits.

1

u/lev_lafayette 2d ago

I recommend Pascal before C. Heck, I still have the book I used to do this with titled: "From Pascal to C"

1

u/UnpaidCommenter 2d ago

For me, yes, learning Pascal definitely helped me learn basic programming concepts. And that helped me when I was learning C. Pascal was like having training wheels when learning to ride a bike.

1

u/mcsuper5 2d ago

My High school had BASIC, then Pascal and a bit of Fortran back in the 80's. Professor let me skip to a second level course using C. When I spoke to him, he told me to get a book to get my feet wet. Transitioning from Pascal to C was extremely easy. The only thing that required any thought at all was C's lack of sets. (I remember almost nothing of Pascal Files and Pointers.) To be fair, C pointers took a minute, but people who took the first course had problems with them too.

It's much easier to go from a strict language to a more relaxed one. I think learning Pascal first helped me write better code in C. So it probably helps other people understand my C better (assuming anyone looks at it.)

1

u/peno64 2d ago

40 years ago yes, now, no. There is no point I now first learning Pascal.

1

u/Wilzur_Corp 2d ago

Solo aprendí en los 90s Pascal, después Delphi2 , en pandemia aprendí Python y desarrollo web. Ahora estoy retomando Delphi 2, tengo mucho código en esa versión, y voy a profundizar en Delphi y Lazarus/Pascal, no siento la necesidad de aprender C, C++ ni mucho menos C#.

1

u/vegansgetsick 2d ago

I started with turbo pascal in the 90's. And felt a little bit lost with C afterward 😆

1

u/One_Helicopter2696 2d ago

Absolutely, but u might fall head over heels for Pascal, I know I did and ive ever been the same since 🙂‍↕️

1

u/palinurosec 2d ago

younger one who happenes to study pascal too. it was completely useless to my C journey, and its contribution to my journey was the same that knowing more programming languages give you. as of today, starting with C is fine, learning multiple programming languages gives you an important edge, but i would rather invest into programming languages that are actually useful and relevant, like go, java, kotlin etc

1

u/SigmaxAlpha 1d ago

No se, creo que Pascal esta fuera de uso aparte de 'para aprender' y su sintaxis es diferente de la de C, si quieres un primer lenguaje aprende java, Lua, python o incluso el propio C, el libro "Como programar en C/C++" de Harvey M. Deitel y Paul J. Deitel es un exelente libro de introduccion a C y esta diseñado para principiantes o noveles.

1

u/ern0plus4 1d ago

They are similar, if you know one, the other will be easy.

1

u/Stunning_Pineapple57 1d ago

Pascal can help because of how it separates things clearly and isn’t dense on symbols for the sake of the leaner, however it’s generally not going to be useful in real life in the 2020s. So other than a nice friendly glide into programming concepts the learnings are mostly wasted when you transition to the languages you will use, so generally I wouldn’t recommend it. Having said that I’m teaching it to a group of kids because AI is changing the calculus so I want them prior to using it , learn the concepts deeply in ANY language and freepascal is as good as any a path for that

1

u/DecisionOk5750 1d ago

When learning Pascal, you also learn how a compiler works. Thanks to Pascal, I have a better understanding of what optimizations are all about. So yes, I think Pascal made me a better programmer.

1

u/iga666 21h ago

No not really, I was learning pascal first then switched to C. Was very confused at first.

1

u/lixiantr 14h ago

Nah, totally unnecessary nowadays. You can pick up all the same basics just by diving straight into C, and you'll actually end up with a skill people still use. Pascal is pretty much dead weight at this point, so I wouldn't waste your time. Just go with C.

1

u/This_Growth2898 3d ago

C was in part inspired by Pascal. Any additional programming language gives you some new ideas for other languages (at least, for the first 6-10 languages you learn).

1

u/Mediocre-Pumpkin6522 2d ago

It would be more correct to say both C and Pascal were inspired by ALGOL.

0

u/didntplaymysummercar 3d ago

Not Pascal + C, but Delphi was my first language and IMO it didn't help me much a year later when I picked up C++ next.

-2

u/Arany8 3d ago

I do not recommend it if your aim is C. But I would learn Rust instead of C.
Programming languages: basically half of them are very very similar to C, even syntax is very similar.
Personally I hate the curly bracket structure, but with good commenting this can be overcome.

3

u/robthablob 3d ago

I'd differ there, I love Rust, but I don't think its a great choice for a first low-level language. I think learning C will help appreciate why Rust is as it is and the benefits of memory and thread safety.

0

u/[deleted] 2d ago

don't know pascal, had no issues with understanding c, cpp either. Maybe start with assembler, not Pascal?