I managed to hack my way through a few other errors since I last posted, but with this one I wouldn't even know where to start. I certainly hope the next tutorial I find will be more focused on what can go wrong.
Specify the sizes of name and clas between [ ]
>>1488920In C arrays in size HAVE to be knows at compile time, an empty [] is not allowed.Depending on the compiler you CAN pass a varaible to an array (Varaible Length Array), but it cannot be empty. Use a define statement, e.g.#define MAX_LEN_NAME 21#define MAX_LEN_CLASS 41(...)char name[MAX_LEN_NAME];cahr clas[MAX_LEN_CLASS];(...)
char *name;welcome to C
>>1488930>>1488934The tutorial dude had it empty. I've used a bunch of empty [] myself in previous exercises. But it doesn't matter, I added the size and it worked and I'm going to keep doing it like that I guess.>>1488938This gave me an error so yeah. What is * supposed to do?
>>1488930>>1488934I forgot the thank yous, so thank you.
>>1488945* is just a pointer (which means that it's not "actually" storing the data, it's just pointing to the data. instead of storing 1000 characters in the struct, you would be storing 1 memory address)when it comes to char, [] and * effectively achieve the same thing by turning the single char into a sequence of chars (otherwise known as a string) because the char* will point to the beginning of the string
>>1488948Ok, thanks. I'll try to use it again when I'm more advanced.
>>1488953Pointers are fundamental bro
>>1488973https://www.youtube.com/watch?v=KJgsSFOSQv0The part I was stuck on here is structs. You might notice pointers are later in the video, onii-chan.
>>1488979Pointers are fundamental and you need to know this concept as a beginner.
>>1488984relax dude, he's going step by step. you dont start off with pointers if youre completely new to programming
>>1488985born in a post python worldit is a luxury that you're able to say this
>>1488920I suspect you don't know programming yet.I suggest you do Harvard's CS50 course, it's for beginners. It actually teaches you programming using C (and other languages later on), like how you're supposed to think about the problem.