|
Members in Shoutbox
None.
Shoutbox Search
Shoutbox Commands
/w [name] > Whisper
/r > Reply to last whisper /me > Marks as action Shoutbox Information
Moderators may delete any and all shouts at will.
|
Global Shoutbox
Please log in to shout.
[2014-10-13. : 4:15 am] O)FaRTy1billion[MM] -- if it's a constant sizeof might work, but otherwise it would be strlen(char1)+1[2014-10-13. : 4:14 am] Dem0n -- Wait, if I have a string that I want to copy, but I first need to allocate memory for it, would I do char2 = (char *) malloc(strlen(char1))?[2014-10-13. : 4:13 am] Dem0n -- What does this mean: "Address [...] is 0 bytes after a block of size 9 allocated"[2014-10-13. : 4:11 am] Dem0n -- it's some command that you can use that shows you were you get memory leaks[2014-10-13. : 4:11 am] O)FaRTy1billion[MM] -- images_tbl + *(((unsigned short*)images_tbl)+imagesdat.grpfile[img]) -- being lazy is way higher than making pretty code. ![]() [2014-10-13. : 4:10 am] jjf28 -- it had a tiny speck of something right inbetween the eyebrows of that ' '[2014-10-13. : 4:10 am] O)FaRTy1billion[MM] -- in fact I used it a bit in the code I sent you to read tbl files ![]() [2014-10-13. : 4:08 am] O)FaRTy1billion[MM] -- I don't like it because it's like a secret power, like some sort deep magic that I've been afraid to play with ![]() [2014-10-13. : 4:07 am] jjf28 -- it's like a secret power that teachers refuse to give out to higher language students[2014-10-13. : 4:04 am] O)FaRTy1billion[MM] -- I had a cheap advantage of having played with ASM, so I was aware of pointers already. ![]() [2014-10-13. : 4:02 am] O)FaRTy1billion[MM] -- Just hide the pointers behind handles. That's used every day.[2014-10-13. : 4:00 am] jjf28 -- just return a pointer if you need an initialization function, don't trouble your mind with pointers to pointers ![]() [2014-10-13. : 3:59 am] O)FaRTy1billion[MM] -- and pointers to arrays of pointers! And pointers to array of pointers to pointers to arrays![2014-10-13. : 3:58 am] O)FaRTy1billion[MM] -- pointers to pointers, that's where the real fun starts.[2014-10-13. : 3:58 am] O)FaRTy1billion[MM] -- you can pass and change pointers ... if you pass it as album** ![]() [2014-10-13. : 3:52 am] Dem0n -- I think I might just have to deallocate the memory associated with each Photo stored in the Album[2014-10-13. : 3:52 am] jjf28 -- it'll change the location variable "album" and whatever variable you passed to the function will remain unchanged[2014-10-13. : 3:52 am] Dem0n -- I'm not sure because the Album is supposed to store Photo types, and there's a function that destroys the album, and the description says that I have to deallocate any memory associated with that album, and I don't know if that means I just have to free all the Photos, or if I have to free the actual Album[2014-10-13. : 3:51 am] jjf28 -- second you passed a pointer to a function, if the function changes the pointer you sent to it, the rest of your program will not know[2014-10-13. : 3:50 am] jjf28 -- two problems, first (and less important) the one keeping you from compiling, cast to Album: album = (Album*)malloc()[2014-10-13. : 3:49 am] Dem0n -- It says, "Incompatible types when assigning to type 'Album' from type 'void *'[2014-10-13. : 3:48 am] Dem0n -- If I have a function void initialize_album(Album *album), why can't I initialize that pointer using malloc?[2014-10-13. : 3:38 am] jjf28 -- free(null); /** Enter Operating System Code */ if ( isAreaAllocatedToProcess() == false ) SCREAMABOUTMEMORYVIOLATION[2014-10-13. : 3:37 am] Dem0n -- Why wouldn't my professor want me to free it if one of the allocations fails?[2014-10-13. : 3:36 am] Dem0n -- FaRTy1billionFaRTy1billion shouted: just make sure if allocating for description fails or whatever that you free that .. don't want any memory leaks xD Can you explain this nonsense to me? "You don’t have to worry about freeing memory if any memory allocation fails (e.g., one memory allocation was successful, but a second one fails)."[2014-10-13. : 3:34 am] O)FaRTy1billion[MM] -- I was thinking it'd have to be printf("%s", pic->description);, since that's the way printf is used[2014-10-13. : 3:33 am] O)FaRTy1billion[MM] -- so it wouldn't fail, but it also probably isn't good practice. ![]() [2014-10-13. : 3:32 am] O)FaRTy1billion[MM] -- Oh, I've never considered passing a string as the format of printf[2014-10-13. : 3:32 am] jjf28 -- FaRTy1billionFaRTy1billion shouted: jjf28 That should fail. wut, it's a char* to a function that takes a char* and arbitrary characters Use puts instead of printf and it will work[2014-10-13. : 3:32 am] O)FaRTy1billion[MM] -- Though when I last updated it I said I was going to eventually add one ...[2014-10-13. : 3:31 am] O)FaRTy1billion[MM] -- RoyRoy shouted: Your suggestion makes more sense for something like the EUDDB, where there isn't a search function at all. ![]() |