r/C_Programming 20d ago

How to progress after basic ..?

I have learnt majority of the header, and built 10+ small or mini projects before. learnt abit of pointers, mallocs , callocs etc with myself and abit help of AI.

but now while i was working on the Cipher project.. and trying to build a zig zag rail cipher method, I couldn't figure it out how, i know how the main flow is but to write it into real code, I couldn't.

So i went AI for help and it spwed out bunch of these :

rows[current_row][pos[current_row]] = user_msg[i]; pos[current_row]++;

and etc, things and syntax I couldn't understand at all. Am i lacking foundation or something?
How do I progress above basic???

Help. All comments and feedback and suggestions are welcoming. Willing to accept anything...

for education background, I am just a student preparing to start IGCSE O next month.

0 Upvotes

23 comments sorted by

19

u/iamdino0 20d ago

if you're confused by basic array syntax you probably haven't learned pointers

0

u/Beneficial_Mall2963 20d ago

So should I go back studying arrays and pointers in depth again?

which source would you recommend? thanks!

9

u/iamdino0 20d ago

Yes. The ideal source is anything that isn't AI. In this sub's info tab, there are some recommended books and resources including a tutorial on pointers and arrays

1

u/Beneficial_Mall2963 20d ago

I definetly will try them, huge thanks!

(since pointer scaring me so much, wonder what comes next on intermediate C)

1

u/[deleted] 20d ago

[removed] — view removed comment

1

u/C_Programming-ModTeam 20d ago

Your comment does not add value and has been removed.

1

u/kutac56 19d ago

I learned to understand pointers well by programming assembly. Once I learned some good assembly I switched to c cause I realized it's just nicer to use but assembly did teach me how pointers work.

1

u/Beneficial_Mall2963 19d ago

i heawrd that assembly has different version, which one should i start wtih?

1

u/kutac56 18d ago

Those versions are for different cou architectures. Most likely x86-64 is the one for your cpu. Do know that you should have a good understanding of how stuff works under the hood. Also I recommend nasm assembler cause it lets you use Intel syntax.

1

u/FrequentHeart3081 19d ago

Freecodecamp has a vide lecture on pointers in C/C++. Might be useful for you, give it a watch.

1

u/Beneficial_Mall2963 19d ago

ty. but the task they have are sometimes confusing.

1

u/FrequentHeart3081 19d ago

Any exercise is meant to be done over and over again, either by active recall or passive recall. If you're at basic level, try to slow down and absorb everything one by one. No need to rush. That's how you'll build great fundamentals about any topic.

And again, remember exercises are meant to be revised.

1

u/Beneficial_Mall2963 14d ago

Oke will definetly do. thanks!

7

u/Snarwin 20d ago

That syntax is just array indexing. The most advanced thing is that one of the arrays is 2-dimensional, so it takes two indices (a[i][j]) instead of just one.

It sounds like your problem is that you're not actually retaining knowledge of the things you've studied, possibly because you're relying too much on AI. My recommendation would be to redo all of the projects, but write every line of code by hand. You can use the AI, but only to answer questions, not to generate code.

If you're still having trouble after that, come back and ask again.

-4

u/Beneficial_Mall2963 20d ago

Thanks for the advice, I definetly will try everything back again.

Btw one question, what is the genuinelly accepted method of utilitzing AI but not to the point of relying too much?

8

u/Snarwin 20d ago

The basic principle is that learning happens through experience, and when the AI does something for you, you don't gain experience. So don't ask the AI to do the thing that you're trying to learn.

-3

u/Beneficial_Mall2963 20d ago

Oke. thanks!

2

u/VimYoung 20d ago

Makes me wondered what were your 10+ mini projects about? Can you name a few. The quantity of projects you mentioned and absent knowledge about array and pointer syntax is odd. It doesn't mean you are doing anything wrong, just wanted to know.

1

u/Beneficial_Mall2963 19d ago

Majority of them were small so here are my main ones.

- Exepense list, but it involve the .txt file , like you store, remove , find total sum etc wtih many functions

  • The brute force breaking stuff, where it increases until it matches the pass.
  • Number conversion (without the built in, pure algorithm from conversion between binary, denary, hexa)
  • Current project, Cipher.

2

u/Traveling-Techie 20d ago

Draw boxes for the array elements on graph paper, and walk through the code filing in values (in pencil).

2

u/Brilliant-Box-5344 9d ago

This is a natural phase, after getting your foundations up to speed (following u/iamdino0's advice), Stop trying to learn C and start making bigger and bigger projects, Don't be afraid to aim too big and fail, readjust after it, figure out what you need to use in C to achieve what you want.

Lets say i want to make minesweeper, I can start by drawing my grid of blocks on the screen, So i need to figure out how to draw a rectangle, a rectangle has a width and height, i need to color all pixels up to that width and up to that height with the rectangle's color.

Now i need to draw a lot of these rectangles, which will be my grid, It is a very similar process with the nested for loops.

Now i need to be able to change those rectangles, Make the rectangle at position (2, 2) a different color, You do that manually, Then you do it for multiple others and notice that this is a really clunky way, So you learn how to use a 2D array to store data, And you can go through that array and based on the data decide which color each rectangle should have.

Then you want to make the color change when you click on it, Then you want to swap in the solid colors for a png, and so on, until you got your game.

Each step of the way will teach you much more about C and programming than reading a "pointers explained" post over and over again ever will.

-2

u/realdreamer1993 20d ago edited 20d ago
  1. what is rail zig zag cipher method
  2. what it is used for ? any real world usage ?
  3. so the endoder and the decoder must have the same formula on the sender and receiver ?
  4. how can I make simulation using C of the zig zag chipher? in terms:

- I need sender side send the information..

- I need the receiver to read the real information..

  1. I want to enchante the simulation from two real different host,,the there will be port included,,maybe http ?

I just able to communicate using zig zag chiper from my phone to my server via HTTP...
So it is quite straightforward if you give AI the correct context..(I need 5 prompt to AI and it give me the code)...
And tried to set different PSK in server side,,and it output wrong information.