allocation tag

15 questions


1 answers
132 views
0
Why can't I use alloca()?

As far as I know, alloca() dynamically allocates memory in stack, not heap, and releases memory on its own when it returns from routine Then shouldn't it be recommended because it's safer because it d...


1 answers
62 views
0
[C language] Input and output a string into a two-dimensional array

I'm trying to enter a string in a two-dimensional array, but it doesn't workIf the name of the two-dimensional array is matrix, is it correct that each character in the string is in matrix[i][j]?For e...


1 answers
72 views
0
Access violation during dynamic assignment of C language two-dimensional array

DYNAMIC ASSIGNMENT OF TWO-Exception occurred (0x00F55146, Project1.exe): 0xC0000005: Access violation occurred while reading location 0xFDFE01You have received the following message:#include<stdio....


2 answers
137 views
0
How to Use For Statements Using C++ Auto

int * buff = new int[10];for(auto x : buff?? ){ x = 0;}I want to initialize all the buffs that were assigned dynamically to zero, buff?Please tell me how to write down.I tried buff[], buff, etc., but ...


1 answers
95 views
0
The memory value allocated to create a student information management program with a connection list changes.

Making a student management system or somethingThe files are main, student.cpp, student.h When I add student data, I want to use Link List to implement it I received the menu number through the main d...

1 years ago

1 answers
107 views
0
Data search question in C language binary search.

#include<stdio.h>#include<stdlib.h>int idxsearch(int ar[], int first, int last, int target) { int mid = (first + last) / 2; if (first > last) return -1; else { if (ar[mid] == target) ...


1 answers
102 views
0
Problem occurs with dynamic deallocation of C language pointer secondary array.

#include stdio.h#include stdlib.h unsigned int Node_size; float Mean_degree; int (*bin)[2] , i , j , k=0 , l=0; printf(Node size :?); scanf(%d,&Node_size); printf(Mean degree :?); scanf(%f,...

1 years ago

1 answers
116 views
0
To output decimals

int main(void){ int num = 0; int* a = NULL; printf(>Positive Input : ); scanf(%d, &num); a = (int*)malloc(num-2); search(a,num); for (int i = 0; i < num-2; i++) { if(a[i-2] == 0) printf(X )...


1 answers
139 views
0
Ask about printing strings using the C language recursive function.

If you output a string of length 3 using two alphabets ab, aaaaababaabbbaababbbabbbYou have to make it come out like this.A two-dimensional character array is dynamically assigned, and the Distr funct...


2 answers
75 views
0
C Dynamic Allocation Why can I modify or access memory that I released with free()?

#include <stdio.h>#include <stdlib.h>int main(void) { int *pList = NULL, i = 0; pList = (int*)malloc(sizeof(int) * 3); pList[0] = 10; pList[1] = 20; pList[2] = 30; for(i=0; i <3; ++i) {...

1 years ago
- 1 - »

© 2024 OneMinuteCode. All rights reserved.