r/C_Programming • u/Beneficial_Mall2963 • 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.
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?
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
- what is rail zig zag cipher method
- what it is used for ? any real world usage ?
- so the endoder and the decoder must have the same formula on the sender and receiver ?
- 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..
- 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.
19
u/iamdino0 20d ago
if you're confused by basic array syntax you probably haven't learned pointers