python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
What happens to malloced data in a struct in C when it is assigned to another variable?
Let's say I have a structure named "example" which has a member named data which stores data allocated on the heap:
typedef struct _EXAMPLE
{
signed char *data;
size_t size;
} exampl...
William Ryman
Votes: 0
Answers: 3
How to find the size of chunk allocated by malloc in the glibc library?
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char * ptr1 = NULL;
char * newptr = NULL;
ptr1 = (char *) malloc(8 * sizeof(int));
if (ptr1 == NULL)
exit(EXIT_FAILURE...
arka
Votes: 0
Answers: 1
fread() function prints an extra line of random characters
I am trying to read data from a file and save it to a struct and print it to a screen. Everything works but it print and extra line of characters . I tried using malloc but I don't think I am using it...
Strawberry Raen
Votes: 0
Answers: 1