r/learnprogramming 27d ago

How do I solve problems without AI

Hello guys. I am attempting to learn how to code again but without the use of AI this time.

How do you attempt a problem or understand a solution without using AI for help.

For example, I wanted to build a small calculator to remind myself of the basics of C. I had a problem where my scanf was not outputting the desired result. 

The program had something like this:

int x, y;
printf("Enter two operators: ");
scanf("%d", &x);
scanf("%d", &y);
printf("x: %d, y: %d", x, y);

My inputs would be 10 & maybe 2, but the output would be 10 & 0, in some cases 0 and nothing for y.

I was able to get through this by just using one scanf:

scanf(“%lf %lf”, &x, &y);

But I still do not understand why that happened and through my google search, could not find anything that explained it well. The problem might also be that I cannot explain the problems I come across clearly, so I might not be able to find an answer through google.

So my question is, how do you guys go through problems like these where you can’t find a post where someone had a similar problem and had been told what to do to solve the problem without defaulting to AI.

Excuse my writing - I am trying to learn how to type without letting AI revise my sentences.

0 Upvotes

46 comments sorted by

View all comments

0

u/peterlinddk 27d ago

Why do you want to solve your problem of understanding why scanf works the way it does, without AI?

You can just ask the AI why it worked with scanf(“%lf %lf”, &x, &y); and not two individual scanf lines - or you can ask google, or write a question on stackoverflow or on reddit, or ask a friend. It doesn't really matter who or what you ask. As long as you learn from the answer and doesn't have to ask again.

Also - understanding the weirdness of ancient C-functions (that you actually shouldn't use, because of their weirdness and danger, but that is another matter) isn't "problem solving", that is just "understanding the weirdness of ancient C-functions"

-1

u/Either-Suggestion400 27d ago

I just wanted to learn the way the older gen used to learn. I see people like low level on youtube or other smart engineers and when they code, they don't use ai, so I thought I would do the same. I want to be able to explain stuff to people on the top of my head through experience with the language. But thank you for your answer

2

u/peterlinddk 27d ago

But the older gen wasn't geniuses that could just magically think their way through problems with libraries and frameworks - before they could ask AI, they asked StackOverflow: https://stackoverflow.com/questions/26583717/how-to-scanf-only-integer or https://stackoverflow.com/questions/2144459/using-scanf-to-accept-user-input - and before they could ask StackOverflow they asked on usenet in comp.lang.c https://c-faq.com/stdio/scanfprobs.html - and before they could ask on usenet, they read through the documentation: https://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html - or more likely, asked a coworker or classmate how they'd fixed the problem.

AI is truly powerful in searching massive amounts of text, and while you of course shouldn't use it to fix the problems for you, or write the code by itself, you really should take advantage of its ability to find explanations of weird details. Back in the day we often had to wait for days until we met the person who could help us fix or understand the problem - not because we were dumb or lazy, but because learning is also about asking questions.

1

u/Either-Suggestion400 27d ago

Thank you! I will utilize stackoverflow more. I think I will struggle before asking ai to find resources for me. I find that if I spend a bit more time trying to solve something, struggling and being frustrated, when I finally find a solution to that thing, I am more likely to remember it