allocation tag

15 questions


1 answers
126 views
0
[C question] How should I release the dynamic allocation in this situation?

#include <stdio.h>#include <stdlib.h>char *Mystrrev(char *string) { int nLength = 0; char *Mystr = NULL; for(int i = 0; string[i] != '\0'; i++) nLength++; Mystr = (char*)calloc(nLength + 1...


2 answers
56 views
0
[C] Can memory dynamic allocation only be allocated to the memory of the pointer?

#include <stdio.h>#include <string.h>#include <stdlib.h>int main(){ char *pszData; char first[20], second[20]; gets_s(first, sizeof(first)); pszData = (char*)malloc(sizeof(first)); s...

1 years ago

2 answers
78 views
0
C++ Dynamic Assignment Structure Pointer, question for use with other functions

Hi, everyone.I made a simple code. I'd like to hear advice from experts who know the problem.#include <iostream>using namespace std;int CountPlayer;struct SUTDA{ char Name[20];};void Input(){ co...


1 answers
65 views
0
Initialize to 2D array element 0.0C language

When you declare a two-dimensional array dynamic assignment and enter the number of rows and columns, you want all the elements in the array to be initialized to 0.0, but I'm not sure what's wrong. vo...


1 answers
113 views
0
When you dynamically assign a C language array...

#include <stdio.h>int main(){ int * arr1 = (int *)malloc(sizeof(int) * 6); int * arr2 = (int *)malloc(sizeof(int) * 6); int * arr3 = (int *)malloc(sizeof(int) * 6); arr1[3][2] = { {3, 4}, {5, ...

« - 2 -

© 2024 OneMinuteCode. All rights reserved.