#28: Dynamic Memory Allocation in C | C Programming for Beginners

#28: Dynamic Memory Allocation in C | C Programming for Beginners

Programiz

2 года назад

60,565 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@user-iq2xd5fq8n
@user-iq2xd5fq8n - 24.12.2023 16:33

B

Ответить
@PalesaUL
@PalesaUL - 30.10.2023 20:32

I think the answer in B

Ответить
@mossab_millionaire
@mossab_millionaire - 22.10.2023 14:28

random comment for engagement

Ответить
@guidoxenofonte1475
@guidoxenofonte1475 - 02.10.2023 03:41

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

Ответить
@One_piece1089
@One_piece1089 - 10.08.2023 08:49

amazing teacher😍

Ответить
@davebull6321
@davebull6321 - 19.07.2023 11:03

# 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;
}

Ответить
@thesun3267
@thesun3267 - 10.07.2023 12:17

bobloc

Ответить
@user-iz2et4kj9y
@user-iz2et4kj9y - 29.05.2023 15:06

Thanks!!!

Ответить
@seabasschukwu6988
@seabasschukwu6988 - 26.05.2023 07:31

❤❤

Ответить
@rayanalasow7035
@rayanalasow7035 - 26.04.2023 21:57

helped a lot. thanks

Ответить
@harryXinANU
@harryXinANU - 24.04.2023 14:53

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)

Ответить
@plankalkulcompiler9468
@plankalkulcompiler9468 - 19.04.2023 23:59

Thanks for the video, it helped a lot!

Ответить
@errorhostnotfound1165
@errorhostnotfound1165 - 07.04.2023 20:28

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?

Ответить
@thiagaodavez5465
@thiagaodavez5465 - 03.04.2023 21:29

gud

Ответить
@1NazareeM618
@1NazareeM618 - 19.02.2023 19:58

Ответить
@tommyleespartan5640
@tommyleespartan5640 - 18.01.2023 01:27

Great video

Ответить
@videoventures6571
@videoventures6571 - 27.12.2022 17:09

You are doing an amazing job . I have learned alot

Ответить
@racingfan372
@racingfan372 - 26.12.2022 22:45

Quiz answer should be B

Ответить
@binkusarma3398
@binkusarma3398 - 13.12.2022 06:27

L0l0ß

Ответить
@onomemafuru9496
@onomemafuru9496 - 17.11.2022 15:26

Madam please what about calloc?

Ответить
@laylalilly6797
@laylalilly6797 - 08.10.2022 15:55

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 ?

Ответить
@med105keshar4
@med105keshar4 - 07.08.2022 21:57

best for beginner💓

Ответить
@pavanstrange58
@pavanstrange58 - 09.05.2022 13:06

mam u r so pretty 😍

Ответить
@gabrielsantana3861
@gabrielsantana3861 - 07.05.2022 01:17

nice

Ответить
@irfanquader6417
@irfanquader6417 - 06.05.2022 16:32

Your website has helped me a lot in my coding journey, thanks a lot for your contribution to the community.

Ответить
@ankitborkar5161
@ankitborkar5161 - 05.05.2022 09:53

There no, code of Programming task. I want to know.. What's the Exact output.. Please Provide the code..

Ответить
@programizstudios
@programizstudios - 05.05.2022 08:39

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))

Ответить
@programizstudios
@programizstudios - 05.05.2022 08:39

[ 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))

Ответить
@ankitrawat5285
@ankitrawat5285 - 04.05.2022 15:48

you are cute padma <3 , real beauty with brain <3

Ответить
@ABHISHEK-bs6gw
@ABHISHEK-bs6gw - 04.05.2022 14:19

Plz make course on C++.

Ответить