This is why I think learning C (and assembly) is important ... you get a better understanding of the fundamentals.
@martijnb33818 ай бұрын
And for me its way more fun then beeing a webdeveloper.. You are working on the solution instead of learning a framework that falls appart after every update😅
@godnyx1177 ай бұрын
@@martijnb3381 Amazing comment! And don't forget that every year, a new framework is made and yours losses and losses founding, developers and community so you have to learn the new one. 🤦
@martijnb33817 ай бұрын
@@godnyx117 Thank you! I also think that some frameworks or solutions (in my case Magento) are necessary. But i really enjoy building things from scatch, with jQuery, C programming or making a custom PHP project that uses Magento bootstrap to import products. I wish i could do that all day :)
@godnyx1177 ай бұрын
@@martijnb3381 Well, you cannot code all day, it's unhealthy 😉
@madhurbatra3218 ай бұрын
man, you are a legend. All these videos and deep linux/C insights are really good. This is a niche content that may not get absurdly high views, but this is a really high quality content. Thank you! Please continue what you're doing.
@grimvian8 ай бұрын
I really like C and thanks for making informative C videos. I have a few comments: I think you are over editing your videos (less is more) and I think the code should occupy more than half of the screen.
@martijnb33819 ай бұрын
Maybe to complicated for beginners but please use sizeof(*values) instead of sizeof(int). For me this is a bug waiting to happen. Also applies to malloc().
@MrGeorge18969 ай бұрын
Oh I just wanted to comment on this topic too. As a bonus: we can use both forms i.e. "sizeof *values" or "sizeof values[0]". We don't need the brackets after "sizeof" either. They are only needed if we just use "sizeof" with a type name and not a variable name.
@martijnb33819 ай бұрын
@@MrGeorge1896 thx . yep, you are right. Its a personal preference to use sizeof() . I think it is more readable this way. But using 'sizeof(int)' or 'sizeof int' when you have context, is just bad practice. Dont do this in production code. To make it a bit more clear, a 'good' example for malloc: int *pInt = (int *)malloc(sizeof(*pInt)); And when you hate C++ programmers just do: int *pInt = malloc(sizeof(*pInt)); :)
@hedgechasing8 ай бұрын
@@martijnb3381 writing the explicit cast is actually a terrible idea. If you do not include the header that defines malloc, C89 says the compiler should assume it returns an Int and the cast will truncate the pointer on a 64 bit system with 32 but ints (all modern platforms). If you have an explicit cast there, then it will silence a potential warning about implicitly casting from int to pointer, and besides you are introducing another thing to change if you retype the variable. You shouldn’t be calling malloc and casting the return in C++ anyways, you need to use the placement form of the new operator to properly convert a void point into a typed pointer by calling the constructor.
@martijnb33818 ай бұрын
@@hedgechasing I see what you mean. Ofcourse i include stdlib.h. I just use malloc in the same way as Sqlite. And that made a lot more sense to me, then doing sizeof(int) inside of malloc. The explicit cast is there for C++ and to get a warning from the compiler when var pInt changed type. Ooo you say "retype" we are talking about the same thing, probably.. Then i prob dont fully understand the explicit cast. To me it seems safe because you give the compiler the most info. And you will get an error when retype, like: double *p = (int *)malloc(sizeof(*p));
@hedgechasing8 ай бұрын
@@martijnb3381 yeah so if you changed the variable type, then you have to change the cast just as you would have to change the size of. For C code, I am recommending int *p=malloc(sizeof *p) so that you can change Int to anything else, and nothing else needs to change to keep the program working. As for C++ compatibility, you should not be calling malloc in C++ and just casting the result. If you want to dynamically allocate memory, you should just call new and let it call malloc, or if you really want to, the proper way to write that code in C++ would be to use the result of calling malloc within a placement new expression, something like int *p = new (malloc(sizeof *p)) std::remove_reference_t {};
@0LoneTech8 ай бұрын
This is not often the kind of partial sort that helps. It's common to want a specific window into a fully sorted array, without necessarily sorting it all. Consider SQL order by price asc limit 25 offset page*25. Quicksort is easily adaptable to this task, but libc qsort is not. A double ended heap might be better still. uvector-algorithms has functions like selectByBounds and partialSortByBounds for such flexibility.
@slavafrog79462 ай бұрын
Hi, Jacob! How could C interact with Excel sheets? I mean, apart from converting xlsx to CSV, how could I read data from Excel with C? Is there a relatively straightforward way to do that?
@sumitbhosale34018 ай бұрын
Nice Video. Thanks! Hey Can You Implement Vector in C Or Hashmap Using Open addressing in C ?
@justcurious19408 ай бұрын
Nice,Thanks.
@magicmorz7 ай бұрын
hey, could be interesting to make a video about applying BPF filters to sockets and the subject of BPF in general :)
@rustycherkas82298 ай бұрын
Can only imagine the question comes from a beginner who will be meticulously writing complicated code to perform iterative "sub-sorting" on a 2nd field in the struct version... Perhaps writing that single required comparison function is the topic for next week's video??
@nsg6509 ай бұрын
I just do &array[INDEX] since it looks alot cleaner and would cause less logic bugs. Edit: the word i was going for was logic bugs not ub sorry!
@ziyad_ibrahim9 ай бұрын
This way could do more cpu work than in the video Like first you access indexed value after take its address, in video just go 2 more block and send to function
@SlideRSB9 ай бұрын
Less undefined behavior? The notification of baseptr+offset is very well defined in C. Whether or not your code is cleaner is just a matter of taste.
@casperes09129 ай бұрын
@@SlideRSBthis isn’t UB
@ЂорђеМилановић9 ай бұрын
@@ziyad_ibrahimHow will it do more work? Do you know how is "taking" address implemented? It's literrary reversed, you first must get the pointer, and then dereference it. So compiler won't dereference anything in this case, it will just calculate the address.
@SlideRSB9 ай бұрын
@@casperes0912 I know.
@Jack_Pro_video_editor5 ай бұрын
Your recent vidEos are good. With some strategIc editing, they have the potEntial to attract a wIder audience aNd generate morE engagemeNt.
@unperrier59987 ай бұрын
Is everything fine Jacob? It's been a month since your last video.
@greg43678 ай бұрын
OK, another T-shirt idea... qsort() sordid sorting since 1972
@soniablanche56729 ай бұрын
well obviously you can, sorting algorithms take a pointer and the size of the array so all you have to do is adjust the pointer and size parameter lol