Комментарии:
B
ОтветитьI think the answer in B
Ответитьrandom comment for engagement
Ответитьi have a test on tuesday about this subject and you helped me a lot on learning it. i really hope that more and more people will be helped by this and the other videos of yours. God bless y'all and thx for the great content :D
Ответитьamazing teacher😍
Ответить# include <stdio.h>
int main(){
int n = 4;
int* ages;
ages = (int*)malloc(n* sizeof(int));
if(ages == NULL){
printf("Memory cannot be allocated");
return 0;
}
printf("Enter input value\n");
for(int i = 0; i < n; ++i){
scanf("%d",ages + i);
}
n = 6;
ages[4] = 32;
ages[5] = 59;
ages = realloc(ages,n* sizeof(int));
printf("Input value\n");
for(int i = 0; i < n; ++i){
printf("%d\n",*(ages + i));
}
free(ages);
return 0;
}
bobloc
ОтветитьThanks!!!
Ответить❤❤
Ответитьhelped a lot. thanks
ОтветитьAs a new C/Cpp user: I wonder any way or plugin in Vscode which can help me to detect the unused heap list or warn me that the heap list should be deleted or freed(just like the GC in java and python)
ОтветитьThanks for the video, it helped a lot!
ОтветитьI'm getting a warning for ptr = realloc(ptr, n * sizeof(int)); saying that realloc could return NULL, which "will cause the original memory block to be leaked", any know how to fix this?
Ответитьgud
ОтветитьGreat video
ОтветитьYou are doing an amazing job . I have learned alot
ОтветитьQuiz answer should be B
ОтветитьL0l0ß
ОтветитьMadam please what about calloc?
ОтветитьWhen i run the realloc() code in visual studio code it returns an error as its expecting a void data type yet the malloc() worked.
Can anyone 'point' me in the right direction?
Thanks
int *ptr, i , n1, n2;
ptr = (int*) malloc(n1 * sizeof(int));
ptr = realloc(ptr, n2 * sizeof(int)); // error expecting void type in ptr ?
best for beginner💓
Ответитьmam u r so pretty 😍
Ответитьnice
ОтветитьYour website has helped me a lot in my coding journey, thanks a lot for your contribution to the community.
ОтветитьThere no, code of Programming task. I want to know.. What's the Exact output.. Please Provide the code..
ОтветитьQ. What is the correct way to allocate memory to store 12 double data?
A. malloc(20 * double)
B. (double*) malloc(12 * sizeof(double))
C. (double) malloc(20 * sizeof(double))
D. (double*) malloc( sizeof(20 * int))
[ Programiz Quiz ]
Q. What is the correct way to allocate memory to store 12 double data?
a. malloc(20 * double)
b. (double*) malloc(12 * sizeof(double))
c. (double) malloc(20 * sizeof(double))
d. (double*) malloc( sizeof(20 * int))
you are cute padma <3 , real beauty with brain <3
ОтветитьPlz make course on C++.
Ответить