|
What should I look into to figure out how to transform two 1D arrays into a 2D array in C?
|
# ¿ Jan 5, 2018 22:46 |
|
|
# ¿ Apr 28, 2024 19:47 |
|
Jeffrey of YOSPOS posted:Definitely clarify more than that - do you want to end up with an n by 2 array? Maybe say what domain this is for? How is the 2d array going to be used? I kinda feel like that's the sort of thing that you ought to figure out how to piece together on your own, it's trivial if you know how things work and dangerous if you don't. Any reason not to loop through and copying wouldn't work. Sorry, I'm still learning/self teaching C. Your questions helped me find a mistake. I was using code:
code:
This is probably a dumb question but, I've never read anything going into detail about it in the online tutorials I've read/watched, what is dangerous about any of this?
|
# ¿ Jan 6, 2018 02:17 |
|
Jose Valasquez posted:When you are declaring an array the numbers are not 0 based, so you would want [2][10] in your example. Jeffrey of YOSPOS posted:Arrays are prove to out of bounds errors, my concern would be that you'd be given a firm rigid way of doing something, and only learn to manipulate that without understanding it. I see C as somewhat portable assembly language and is hard for me to think of it as a language whose abstractions I can trust without knowing how they work all the way. It's been a while since I've been able to use something other than a phone. code:
|
# ¿ Jan 9, 2018 23:52 |
|
I had to take a break to handle some dumb work things and am back at learning C. Lately I've been having trouble with pointers and structs are there any good tutorials out there? I've watched plenty of youtube tutorials and was looking for something more. Also out of curiosity why do people freak out about recursion so much?
|
# ¿ Aug 15, 2018 19:21 |
|
I can't seem to figure out how to pass a struct to a function as an array. I have this: code:
|
# ¿ Aug 16, 2018 03:20 |
|
I've been trying to get GTK to work with code:blocks but, it seems that every error I fix results in new errors popping up. Is there a better way to set up GTK for C other than going through MSYS2 to get GTK?
|
# ¿ Oct 20, 2018 01:07 |
|
I haven't, I'm working in C so I didn't think Qt would work for it and its the first time I've heard of ImGui. I take it, its probably better to keep to console until I move on to C++ then work with Qt? E: Or is it possible for me to build a GUI in VS2017 then use my C code with it? Azuth0667 fucked around with this message at 22:43 on Oct 20, 2018 |
# ¿ Oct 20, 2018 22:40 |
|
I wanted to learn and the OP mentioned that its generally better to start in C so I started and kept with it because I like the language. I intend to learn both.
|
# ¿ Oct 20, 2018 22:49 |
|
Is the C Programming Language by Kernighan and Ritchie still a good one to have for learning C? I bought Beginning C by Ivor Horton, cheap, and it was good until it hit strings so I've been looking for something else.
|
# ¿ Oct 20, 2018 23:01 |
|
elite_garbage_man posted:You can certainly give gui's a try right now. An important skill to learn is bringing in 3rd party libraries, building and linking them, so it's better to learn it sooner rather than later imo. You don't want to have to code everything yourself just because you never learned how to link to static and dynamic libs. It's also done different ways using build chain tools like different ides, make, cmake etc... Some projects support multiple build tools while others only support one. It's definitely alot of grunt work at first, but the pay off iss pretty big considering you won't have to keep re-inventing the wheel. Thanks for the pointers. I was originally going to use it as a stepping stone but, after putting 100 hours into it I really like the language so I'm sticking with it and going to add C++ eventually. I've got a colleague in my institution's math department that showed me some cool stuff that we could do with a bunch of data, that I thought was trash, once I get a better grasp of C so there's some more motivation.
|
# ¿ Oct 23, 2018 03:05 |
|
I want to read text from a window in a program then use that information to submit keyboard input into an entry field in the same program. Where should I look to start getting an idea how to do this? E: I should clarify I'm using C. Azuth0667 fucked around with this message at 18:11 on May 9, 2019 |
# ¿ May 9, 2019 18:06 |
|
nielsm posted:On Windows? And is it a plain edit control and not rich text? Is it a native text control and not a "faked" one through some other GUI framework or even custom? Oops, forgot about that and yes it is Windows. I'm not really sure how to answer the rest of that. From the UI it has one main window that is partitioned into other smaller windows of which all but, one are full of text. The remaining window looks like a long form answer field from a survey. c0burn posted:If this is more "how do I do x thing at my job quicker" than C coding, I'd do it in AutoHotkey or AutoIT I tried autohotkey but, it doesn't seem to be able to read text from this program.
|
# ¿ May 10, 2019 01:28 |
|
I'm piloting a new virology course in the fall and I'm trying to make a game to provide an interactive example of how they interact with host cells. I'm not sure why but, for some reason in the DisplayMenu function when it calls DisplayStats the output is all garbage values. However, when DisplayStats is called in Main it shows the values that were assigned in GenerateVirus and DisplayUIBar also shows the assigned values. This is on windows and in C, what am I screwing up?code:
Player Statistics: Name: ╨@ Number T: 4199040. Is DNA Virus: 4199040. Is RNA Virus: 0. Genome Size: 2774421698444822856892921245859840.00. Number of Strands: -2. Infections Caused: 1997040570. Azuth0667 fucked around with this message at 02:24 on Jun 22, 2019 |
# ¿ Jun 22, 2019 02:17 |
|
nielsm posted:snip Thank you both, it looks like I still have a lot to learn when it comes to pointers and memory allocation.
|
# ¿ Jun 23, 2019 01:04 |
|
There's no way to pass a member of a structure to a function in c right? I have to pass a pointer to the structure instead?
|
# ¿ Jun 27, 2019 15:01 |
|
|
# ¿ Apr 28, 2024 19:47 |
|
Absurd Alhazred posted:You mean something like this? Similar, I have: code:
|
# ¿ Jun 27, 2019 15:11 |