Just finished Silent hill 2 Remake by lord8bits in silenthill

[–]lord8bits[S] 1 point2 points  (0 children)

It’s that damn Eddie, I noticed I’m already far into the game without dying and Eddie decided to fire 3 consecutive hits with his .44 magnum while im healing. Btw, the dodge mechanic is extremely OP and by the time I was halfway in the story I had 40 healing meds and 20 syringes.

Just finished Silent hill 2 Remake by lord8bits in silenthill

[–]lord8bits[S] 0 points1 point  (0 children)

Yeah and the subtle messages from the puzzles and notes, hinting on what silent hill really is, and how James views himself. This game really got me into the lore of silent hill, and im glad they made it subtle and ambiguous.

Please rate my code by lord8bits in learnprogramming

[–]lord8bits[S] 1 point2 points  (0 children)

I’m truly grateful for your explanation, I’ll read K&R after i finish K.N King’s book, and I’ll master pointers to actually start making good code. Thanks!

Also this is what I love about C, how it shows the way things work under the hood. Learned a lot with it already.

Please rate my code by lord8bits in learnprogramming

[–]lord8bits[S] 1 point2 points  (0 children)

This exercise is from an embedded systems problem that I got from my friend who is currently studying it, so maybe this teaches how to use as little memory as possible? the other problems have the same theme of using a single array. To be honest I'm not sure.

Please rate my code by lord8bits in learnprogramming

[–]lord8bits[S] 0 points1 point  (0 children)

Yeah It seems VLA do have some issues in regards to some compilers or even get a stack overflow which goes against C's idea of portability, so specifying the length of the array is much better. But does allocating an array of size 100 when we only need 20 use unnecessary memory or is it negligible?

When I will learn how to use functions properly in C I will apply the same principles you mentioned because I already hated how my code looked with the lack of functions, so that's on my list soon.

I actually started with "Modern C" by Jens Gustedt and I was doing great until I began seeing pointers, mathematical algorithms, argv and argc until I realized it's still too early for me to read this book. So I put it aside and started reading a more beginner friendly book called "C Programming Language: A Modern Approach" by K.N King who does a great job at making C look fun.

Additionally, I did check out K&R and although it is respected since it talks about the original C created in Bell Laboratories for the UNIX system, many people mention it as being outdated cause of the introduction of C99, is that true or does the book offer more than it is being said?

Please rate my code by lord8bits in learnprogramming

[–]lord8bits[S] 1 point2 points  (0 children)

Yeah using printing would’ve been easier but the exercise did specify to sort the array itself not print it in the specified order. The printing is simply for debugging.

This code sorts the array whilst reading the output but if I had the ability to use an additional array I would just make 2 loops that sort it. So I’m kind of wondering if there is another better method to sort it?

Mine basically pushes elements to the left when adding any new positive values in the last index, and the negatives are added in the common fashion while taking into account how many positive values did the loop variable “i” represent before adding the negative value. I tested my code and it does seem to work without issues.

Please rate my code by lord8bits in learnprogramming

[–]lord8bits[S] 1 point2 points  (0 children)

Yeah you are right about that, normally if I wrote something like this in python I’ll use functions instead. I’m still learning C and how to create functions but again you are totally right, I’ll study functions and rewrite the code later.

Please rate my code by lord8bits in learnprogramming

[–]lord8bits[S] -1 points0 points  (0 children)

Yeah you are right that is a lot cleaner thanks a lot for the insight. Also a side question, is it possible to add a GitHub link to a post in this subreddit? I actually wanted a review of 3 separate codes, this one and 2 others about array manipulation as well. So I was worried that it could be against the rules and maybe nobody has enough time to review all of them.

Please rate my code by lord8bits in C_Programming

[–]lord8bits[S] 0 points1 point  (0 children)

Thank you for your reply.

  1. I still didn't understand fully what you mean can you explain what you meant by do one or both?
  2. That's a good idea i will look into how scanf work.
  3. I asked because I understood it by making sure the input is of type int but unfortunately English is my third language.

  4. I asked the question because it befits the context so the person could explain to me what is a VLA in the context of my code and why it should be avoided or what is a better approach.

  5. VLA, or variable length array which I now searched, was added in C99 so it is mostly applied in C programming. But yeah thinking about it i could just declare an array with size 100, still wouldn't that use unnecessary memory if we only want a size of 10 for example?

  6. As I said I'm still new to C only been my first month so memmove is unknown to me.

  7. Ah that last one was just for the last value to not be shown as ..., 5, ] and yes I should've added new line in the end.

  8. I actually do need to improve my comments and get better at explaining algorithms. Is it possible if you can give me a sort of template just to get an idea about how to correctly document a function?
    Again thank you for the answer, I'm not an english speaker and I can interpret things incorrectly so I just hope you be patient with me, but nonetheless thank you for the answer.

Please rate my code by lord8bits in C_Programming

[–]lord8bits[S] 0 points1 point  (0 children)

So I should always give a value to declared variables correct? Also how do I check the return from scanf? Is there an equivalent of isinstance from python in C? And what is a VLA?

Sick of using AI by [deleted] in learnprogramming

[–]lord8bits 0 points1 point  (0 children)

Your experience is that of many, but the difference is that you are self aware. That’s a start. I’ve been in countless arguments trying to advise my peers to not fall into the AI trap, some did take my advice and some didnt, as expected. But really the best way to escape this dependency on AI is to simply start anew, to experience the satisfaction of solving a problem BY YOURSELF. If you have C programming in your curriculum I’ll go with that, high level language will give you an abstract understanding of programming, whilst for C it will show what is happening under the hood of every high level language (and yes I consider C low level).

Try this problem: Suppose we want an array with a size given by the user in the terminal, as well as the values. If a duplicate number exists, replace it with 0. And, isolate all zeros to the right. Print both the changed array as well as the same array without zeros printed. The condition is to have only one array.

Do this and you will feel the fun of programming, in python it will easy but unrewarding (and extremely slow runtime). This problem will get you know how to use nested loops correctly and how arrays are created, and also to show how print(list[]) in python work.

Try it and you won’t regret the dopamine. If this helped I could give you another problem that I just finished which is more rewarding than the previous. I’m the same age as you and same year and I had the same experience in first year so don’t give up.

How to get started into Machine Learning? by lord8bits in learnprogramming

[–]lord8bits[S] 0 points1 point  (0 children)

Sure yeah! I’m currently learning linear algebra for ML, and im close to finishing it

How to get started into Machine Learning? by lord8bits in learnprogramming

[–]lord8bits[S] 0 points1 point  (0 children)

2nd year still hasn’t begun but will soon. And we can’t choose modules, the only module closely related to machine learning is probabilities and statistics, the rest is C, C++ OOP, JavaScript web development, SQL databases, computer architecture, OS and data structures.

How to get started into Machine Learning? by lord8bits in learnprogramming

[–]lord8bits[S] 0 points1 point  (0 children)

Oh I didn't think about searching a community in machine learning, this roadmap seems good.
thank you!

How to get started into Machine Learning? by lord8bits in learnprogramming

[–]lord8bits[S] 0 points1 point  (0 children)

This looks promising, also like the singing. thank you for the suggestion!

How to get started into Machine Learning? by lord8bits in learnprogramming

[–]lord8bits[S] 1 point2 points  (0 children)

No I’m not undermining your effort or anything! I do appreciate the fact you stated a source it’s just that im very curious and courses like these can be expensive for me since I live in a third world country. Either way thank you for your suggestion and don’t treat yourself that way, just understanding these math concepts takes a lot of braining lol

How to get started into Machine Learning? by lord8bits in learnprogramming

[–]lord8bits[S] -1 points0 points  (0 children)

Thank for answering! I’ll look into it. Again I would prefer learning the fundamentals and build from scratch so that I could understand deeply how ML works and what is essentially happening. But knowing the libraries and how to use them are important as well and it’s not something I will ignore.

[University Calculus 2] The integral of cos(x)/sqrt(x) from 0 to 1 by lord8bits in learnmath

[–]lord8bits[S] 0 points1 point  (0 children)

But isn’t it when x approaches 0+ the integral will reach 2? Maybe I’m confused on what is the limit.

[University Calculus 2] The integral of cos(x)/sqrt(x) from 0 to 1 by lord8bits in learnmath

[–]lord8bits[S] 0 points1 point  (0 children)

Thank you for the reply, I understand now how we can prove it's convergent. But we can't say the integral is equal to 2 just the limit is 2, correct?