I'm an absolute beginner in C programming, watching your video gave me the impetus I need to learn C language upto becoming a master. Thank you and have a felicitous intellectual journey ahead!
Sure! Good point and that one is even reported by GCC, when using the -Wall flag :) but the goal of that exercise is to abuse whatever you can in the provided compiler to achieve the smallest possible source code
My First Programming language was python, then I moved to C. When I was Learning python i struggled with logic building. But After learning C im getting better with Logic, and Also Better at JavaScript.
Ah yes, because we sure do love writing non portable code! are we forgetting about the fact that C is a systems language? if you need code specific to a certain platform, then use stdint.h types, if you need portable code that works between platforms where you don't know what the width will be, then use standard integer types. I thought this was figured out like 50 years ago, we can't have devolved that much, right...?
@@tiranito2834 why should normal ints be more portable? There is no real point in using normal ints over standard int. Platform dependent types are only necessary for system level interfaces and working with pointers. And in most cases the explicitly platform dependent size_t is all you need. Having the possibility that your int might be "arbitrarily" long depending on the platform might even cause bugs in form of unexpected integer overflow or compile errors in case of to large literals. Tldr always use stdint.h if possible. It makes the code more stable and compatible and portable.
Answering your question about what languages I want to learn are: I've been trying to learn Rust for months, I took courses and read books but I haven't made any progress, I feel stuck, my goal with Rust is the backend, even in the same book it tells you that before that you must know C++. My biggest dream is to master Rust and then C++. that's why I started following your channel, thanks
Yes, Rust/C++ require a lot of time invest. They are really hard to master, but still you can write good code without mastering each piece of a particular language.
I think beauty is subjective and depends on context. Here I used it a little bit ironically, since you can still do things that should not be allowed, at least by default. Hopefully compilers are evolving and, i.e. GCC 14 rejects such code by default which is good in my opinion!
Swietny material. Wiecej tego sortu filmikow :) Jakbys jeszcze tylko wrzucal regularnie materialy to mozna by pomyslec o jakies formie wspierania kanalu
Dziękuję! Regularność niestety aktualnie nie wchodzi w grę, choć marzy mi się przyspieszenie montażu (pewnie kwestia wprawy). Kanał rozwijam w swoim wolnym czasie, a do tego dopiero uczę się nagrywania i montażu :) Póki co wystarczy lajk lub miłe słowo :)
I always recommend doing actual programs instead of courses. To be honest I almost always boycott most of course, it's too boring for me instead I am using them as a "what to learn next" list. Then think about what program you could wanna write and try to do it. It won't be perfect for the first time, but you can gain real experience and continuously improve it. It could be big or many small ones, but always think how you can improve them after all. When I was taking part in interviews in my previous company always the best candidates were with people that came with projects on GitHub that they prepared by themselves and it was easier for them to adapt to project.
@@matgla95 Let's say I want to learn how like you, where would I start, if there is a lot of information, like the basics without having to go through the courses, the githubs are huge and there are topics in a single repository of different things, the documentation is technical and difficult, as you did at the beginning to later be able to extricate yourself from c, this answer would help me a lot more. greetings
I don't mean to completely drop courses, they are necessary to learn basics. I also started with a course something like " from zero to games coder". And with each exercise I did a similar one on my own. Like it was a random number generation section with exercise with solution, so I did it, but then wrote my own program that also uses random number generation. With some basics I started writing game, since it was fun for me, step by step. With no knowledge it required a lot of internet research, like the first goal: select library, then render black window in OS... Trying to move from courses to reading reference manuals for language and documentation for libraries. Today all those GPT/Copilot could help to speed up information searching on given topic. Starting you may want to write as much as possible on your own, it's reinventing a wheel, but needed if you want to get deep knowledge. But most important is to find a way of learning that makes you fun. If it's not fun most probably you won't be able to spend enough time to grow fast, so the whole road will be longer. Keeping fingers crossed :) Which language you are trying to learn?
@@matgla95 I've been trying to learn Rust for months, I took courses and read books but I haven't made any progress, I feel stuck, my goal with Rust is the backend, even in the same book it tells you that before that you must know C++. My biggest dream is to master Rust and then C++. that's why I started following your channe
To be honest, me too. C can't be substituted in some environments. But whenever it could be I think it should be. I mostly use C++, but I am looking for tools that can improve or even replace it into safer language transpilers ( like cppfront ), where other compilers like (i.e rust are not fitting). But I really hope that the standardization committee will resolve most of the problems some day.
main(k){while(scanf("%d"))printf("%d ",k++*k/2);} is it a valid solution? It is 3 characters shorter. Also the original version with "%d " gave me segfault so I went with "%d ". I would like to try more but I really don't understand the coding challenge here. Why do we even scan for numbers? The rules are unclear to me, perhaps it's due to traduction from polish.
Originally that code doesn't contain . It was added just to better presentation of execution. The testing from SPOJ is executed for many inputs from stdio and space is necessary to separate outputs for test cases.
And that was one of the reasons that I decided to publish that video :) it's an old challenge and the current solution is easy on the internet to find, so I hoped someone will try to reduce it more! Unfortunately since the whole website is old and I am not even sure it is maintained, the latest compilers are not available.
Yes you're right, I have a problem with recording on Linux ( my camera interface produces crazy delays, most probably Nvidia again broke their driver xd ) which I haven't solved yet, so I temporarily switched to windows.
@@matgla95 That's no excuse to have it running in the background. Honestly, I'd be embarrassed. You do you though. I'm sure your excuses will safe you from the social credit system you help implement by running spyware. Oh, and don't get me started on the smart phone which I'm pretty sure you have too.
@@matgla95 You sound like a smoker telling me that smoked meat takes longer to go bad. I guess the copium is always real. Anyway, you keep making excuses for being the corporations' female canine. Another thing though. Are you actually in Poland? We are always looking for Team Fortress people in Europe. I wrote a fork of the original for the Darkplaces engine with more emphasis on tactics and stealth.
I'm an absolute beginner in C programming, watching your video gave me the impetus I need to learn C language upto becoming a master. Thank you and have a felicitous intellectual journey ahead!
Thanks! let's do it! Keeping fingers crossed!
But it is defined as 'undefined behaviour' the part of the code >>k++*k/2
Sure! Good point and that one is even reported by GCC, when using the -Wall flag :) but the goal of that exercise is to abuse whatever you can in the provided compiler to achieve the smallest possible source code
Doesn't matter if it works, make it readable or I'm not approving your PR.
me too, it's totally unuseful code :) and it sometimes works because it uses old GCC compiler implementation hacks
My First Programming language was python, then I moved to C. When I was Learning python i struggled with logic building. But After learning C im getting better with Logic, and Also Better at JavaScript.
Yup, different languages due to different paradigms enforce to improve the skill set and it seems you have a win-win outcome :)
imagine not knowing how long your integer primitives are because it depends on the platform
nice elegance bud
thanks, It's even worse when types promotion come to case when you have different type sizes on different platforms.
stdint.h...
Anyone not using them is just stupid or has an old codebase.
Ah yes, because we sure do love writing non portable code! are we forgetting about the fact that C is a systems language? if you need code specific to a certain platform, then use stdint.h types, if you need portable code that works between platforms where you don't know what the width will be, then use standard integer types.
I thought this was figured out like 50 years ago, we can't have devolved that much, right...?
@@tiranito2834 why should normal ints be more portable?
There is no real point in using normal ints over standard int.
Platform dependent types are only necessary for system level interfaces and working with pointers. And in most cases the explicitly platform dependent size_t is all you need.
Having the possibility that your int might be "arbitrarily" long depending on the platform might even cause bugs in form of unexpected integer overflow or compile errors in case of to large literals.
Tldr always use stdint.h if possible. It makes the code more stable and compatible and portable.
it will works cuz of gcc it set variables and funcs to type int as default
Yes, but it uses more than that :)
Answering your question about what languages I want to learn are: I've been trying to learn Rust for months, I took courses and read books but I haven't made any progress, I feel stuck, my goal with Rust is the backend, even in the same book it tells you that before that you must know C++. My biggest dream is to master Rust and then C++. that's why I started following your channel, thanks
Yes, Rust/C++ require a lot of time invest. They are really hard to master, but still you can write good code without mastering each piece of a particular language.
very thanks, greatings
saludos desde Bolivia, querido amigo.
There are better languages for backend
@@youarethecssformyhtml For the niche I am aspiring to, they are the fastest and what I need to learn. Thanks for your comment, greetings
Erlang, any ML, any Lisp and Haskell are beautiful.
If someone finds C beautiful they also find spoiled foods yummy.
I think beauty is subjective and depends on context. Here I used it a little bit ironically, since you can still do things that should not be allowed, at least by default. Hopefully compilers are evolving and, i.e. GCC 14 rejects such code by default which is good in my opinion!
Swietny material. Wiecej tego sortu filmikow :) Jakbys jeszcze tylko wrzucal regularnie materialy to mozna by pomyslec o jakies formie wspierania kanalu
Dziękuję! Regularność niestety aktualnie nie wchodzi w grę, choć marzy mi się przyspieszenie montażu (pewnie kwestia wprawy). Kanał rozwijam w swoim wolnym czasie, a do tego dopiero uczę się nagrywania i montażu :) Póki co wystarczy lajk lub miłe słowo :)
Any advice for learning to program, without staying in the infinite loop of the courses, any tips that were useful to you, thank you
I always recommend doing actual programs instead of courses. To be honest I almost always boycott most of course, it's too boring for me instead I am using them as a "what to learn next" list. Then think about what program you could wanna write and try to do it. It won't be perfect for the first time, but you can gain real experience and continuously improve it. It could be big or many small ones, but always think how you can improve them after all. When I was taking part in interviews in my previous company always the best candidates were with people that came with projects on GitHub that they prepared by themselves and it was easier for them to adapt to project.
@@matgla95 very thanks 🙏🏻
@@matgla95
Let's say I want to learn how like you, where would I start, if there is a lot of information, like the basics without having to go through the courses, the githubs are huge and there are topics in a single repository of different things, the documentation is technical and difficult, as you did at the beginning to later be able to extricate yourself from c, this answer would help me a lot more. greetings
I don't mean to completely drop courses, they are necessary to learn basics. I also started with a course something like " from zero to games coder". And with each exercise I did a similar one on my own. Like it was a random number generation section with exercise with solution, so I did it, but then wrote my own program that also uses random number generation. With some basics I started writing game, since it was fun for me, step by step. With no knowledge it required a lot of internet research, like the first goal: select library, then render black window in OS... Trying to move from courses to reading reference manuals for language and documentation for libraries. Today all those GPT/Copilot could help to speed up information searching on given topic.
Starting you may want to write as much as possible on your own, it's reinventing a wheel, but needed if you want to get deep knowledge.
But most important is to find a way of learning that makes you fun. If it's not fun most probably you won't be able to spend enough time to grow fast, so the whole road will be longer. Keeping fingers crossed :) Which language you are trying to learn?
@@matgla95 I've been trying to learn Rust for months, I took courses and read books but I haven't made any progress, I feel stuck, my goal with Rust is the backend, even in the same book it tells you that before that you must know C++. My biggest dream is to master Rust and then C++. that's why I started following your channe
What does the tilde ~ symbole mean in C ? Just before the scanf
It just performs bitwise negation on value returned from scanf function to break loop when got EOF ( which normally is -1 ).
You know, the more I watch this video, the more I'm grateful I'm a Pascal/Delphi and Ada dev, this is wild, I feel pity for C devs 💀
To be honest, me too. C can't be substituted in some environments. But whenever it could be I think it should be. I mostly use C++, but I am looking for tools that can improve or even replace it into safer language transpilers ( like cppfront ), where other compilers like (i.e rust are not fitting). But I really hope that the standardization committee will resolve most of the problems some day.
I guessed correctly but I liked anyways! Good video
Thanks! :)
Nice code bro
Thanks !
main(k){while(scanf("%d"))printf("%d
",k++*k/2);}
is it a valid solution? It is 3 characters shorter.
Also the original version with "%d " gave me segfault so I went with "%d
".
I would like to try more but I really don't understand the coding challenge here. Why do we even scan for numbers? The rules are unclear to me, perhaps it's due to traduction from polish.
So, let me clarify a little bit.
The code is on SPOJ and is executed for 10 test cases.
Test data is provided on STDIN in the form:
1
Why is there a space between %d and
?
Originally that code doesn't contain
. It was added just to better presentation of execution. The testing from SPOJ is executed for many inputs from stdio and space is necessary to separate outputs for test cases.
can u give us a link to the challenge
Sure, pl.spoj.com/problems/SUMAN/
And more exercises and challenges like this are here: www.spoj.com/
@@matgla95 I have a 52 letter solution but how do I make it use the correct compiler :c
And that was one of the reasons that I decided to publish that video :) it's an old challenge and the current solution is easy on the internet to find, so I hoped someone will try to reduce it more!
Unfortunately since the whole website is old and I am not even sure it is maintained, the latest compilers are not available.
I lied, I misscounted, sorry for my ignorance :D
@@CodingWithDox I am glad you tried. Someday someone for sure will find a better solution :)
That is so cool 😂
Imagine my face when I found that type is not needed in the main function argument :)
I see Windows, I leave.
Edited to get rid of the heart sticker.
Yes you're right, I have a problem with recording on Linux ( my camera interface produces crazy delays, most probably Nvidia again broke their driver xd ) which I haven't solved yet, so I temporarily switched to windows.
@@matgla95 That's no excuse to have it running in the background. Honestly, I'd be embarrassed. You do you though. I'm sure your excuses will safe you from the social credit system you help implement by running spyware. Oh, and don't get me started on the smart phone which I'm pretty sure you have too.
No no, I am only using pigeon post :)
@@matgla95 You sound like a smoker telling me that smoked meat takes longer to go bad. I guess the copium is always real. Anyway, you keep making excuses for being the corporations' female canine.
Another thing though. Are you actually in Poland? We are always looking for Team Fortress people in Europe. I wrote a fork of the original for the Darkplaces engine with more emphasis on tactics and stealth.
Jerk
My solution to this in a theoretical language that sees and interprets whatever prompt you give it:
an empty file. That language needs no code
No Code, No Problems! :)