开发者

realloc

0
  • Using realloc to shrink the allocated memory

    Simple question about the realloc function in C: If I use realloc to shrink the memory block that a pointer is pointing to, does the \"extra\" memo开发者_StackOverflowry get freed? Or does it need to[详细]

    2023-03-28 15:44 分类:问答
  • Dynamically storing information from a file using C

    I\'m new to C and trying to learn a few things. What I\'m trying to do is read in a file and store the information. Since the format will be a CSV, the plan is to read in each character, determine if[详细]

    2023-03-27 23:16 分类:问答
  • Errors when using realloc()

    I am using realloc() to dynamically size some arrays. Because I was writing a lot of code like this: void *tmp;[详细]

    2023-03-24 15:14 分类:问答
  • C - Dynamic Array

    I\'m trying to feed an array with fscanf() while looping through a file containing a list of integers, n integers long. It seems that I need to use malloc and/or potentially realloc. I\'ve heard that[详细]

    2023-03-21 04:40 分类:问答
  • Using realloc on array of structures

    I\'ve been scratching my head for hours on this.This reads data from a text file into the struct (each line has four strings, and each line represents a new student).I am getting a seg fault on the re[详细]

    2023-03-19 19:54 分类:问答
  • Realloc an array of Structs

    I am trying to dynamically reallocate memory for an array of structs (actually an array each of 2 structs but 1 included here for simplicity) that is being read from/to a file or inputted by the user.[详细]

    2023-03-09 06:35 分类:问答
  • Does memcpy() uses realloc()?

    #inlcude <stdio.h> #inlcude <stdlib.h> #inlcude <string.h> int main() { char *buff = (char*)malloc(sizeof(char) * 5);[详细]

    2023-03-08 03:24 分类:问答
  • Realloc Vs Linked List Scanning

    I have to read from a file an unknown number of rows and save them in to a structure (I would like to avoid a prepocessing to count the total number of elements).[详细]

    2023-03-05 15:57 分类:问答
  • C realloc inside a function

    Here is my code: #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h>[详细]

    2023-03-05 01:05 分类:问答
  • How can realloc not work but malloc can?

    I have reached a point where realloc stops returning a pointer - I assume that there is a lack of space for the array to expand or be moved. The only problem is I really need that memory to exist or t[详细]

    2023-03-04 00:11 分类:问答