C_134 Dynamic Memory Allocation using calloc() | C Language Tutorials

  Рет қаралды 109,831

Jenny's Lectures CS IT

Jenny's Lectures CS IT

Күн бұрын

Пікірлер: 84
@_AHMATSENOUSSI
@_AHMATSENOUSSI 2 жыл бұрын
Difference between Malloc and Calloc function MALLOC CALLOC -Accept one argument only -Accept two argument -The allocated memory would be initialized With garbage value -The allocated memory would be initialized with 0. -Allocate single block of memory - Allocate multiple block of memory
@divyprakashpandey4458
@divyprakashpandey4458 Жыл бұрын
This session's notes - Calloc() fxn - Calloc stands for Contiguous Allocation - Built-in function in stdlib.h - Its Function→Used to dynamically allocate multiple blocks of memory & each block is of same size - General Syntax↓ - void* calloc(size_t no._of_blocks , size_t*size_of_each_block); - Malloc VS Calloc - In Calloc the blocks are initialized with 0 & in Malloc it is initialized with Garbage Value - In Malloc a Single block of memory is allotted, In Calloc for same memory smaller memory blocks are allotted [yes, it confuses me too
@naughty_nobitha
@naughty_nobitha 8 ай бұрын
bane xtral dengav ga
@rabbit-g3l
@rabbit-g3l Ай бұрын
I'm confused about the same thing too in the last point
@abdulrahimjalloh363
@abdulrahimjalloh363 Жыл бұрын
Assignment Two: 1. callloc means "contiguous allocation" 1. malloc means "memory allocation" 2. calloc is generally used in array 2. malloc is generally used in structure 3. calloc takes two arguments 3 malloc takes one argument 4 calloc dynamically allocate multiple block of memory of the same size 4. malloc allocate single block of memory 5. by default calloc initialize with zero values 5. by default malloc initialize with garbage values
@devSackey
@devSackey Жыл бұрын
Diifrence betweeen malloc() and calloc() functions Malloc() 1. The allocated memory by default is initialised with garbage value 2. Allocate a singly large block of memory 3. The function has one parameter Calloc() 1. The allocated memory by default is initialised with 0 2. Allocate multiple block of memory 3. The function has two parameters
@learnwithme6937
@learnwithme6937 2 жыл бұрын
mam.....you are so special.... thank you for being on KZbin for us.........😇😇😇
@abdulrahimjalloh363
@abdulrahimjalloh363 Жыл бұрын
Assignment one: #include #include int main (void) { int n,i,j,*ptr1; float num,*ptr2; printf(" Enter number of blocks: "); scanf("%d",&n); ptr1=(int *)calloc(n,sizeof(int)); if(ptr1==NULL) { printf("Cannot allocate memory "); exit(1); } printf("Enter values for calloc: "); for(i=0;i
@Skclubs988
@Skclubs988 2 жыл бұрын
So lovely mam i watching your videos since one year i cleared 3rd year help the ur video❤
@jony-s5m
@jony-s5m 2 жыл бұрын
I love your teaching skill ma'am
@cheharmani1303
@cheharmani1303 2 жыл бұрын
Gajab padhate ho mam 😍😍🥰 really very nice .
@sheesh7070
@sheesh7070 2 жыл бұрын
The way you talk mam...❤️ It's just too much flashy
@VIDITSHRIMALI-l8o
@VIDITSHRIMALI-l8o 2 ай бұрын
lots of thanks and appreciation for the beautiful content just like your beautiful heart
@SakshiPatidar371
@SakshiPatidar371 2 жыл бұрын
Thanku mam Please start python also... Please mam Ur teaching way is awesome Please 🙏
@DevManuel-t6x
@DevManuel-t6x Жыл бұрын
Thank you first of all for all you have been doing, you have made c programming easy to grasp. I have a question please, some c programmers have raised the argument of typecasting the return value of malloc. They say it is not really right can you please shed more light on that because from my little understanding of C I actually agree with your method of Typecasting.
@efx.6990
@efx.6990 2 жыл бұрын
First view mam😍♥️
@TEJASPLAYZ
@TEJASPLAYZ Жыл бұрын
THANKS 👍👍
@bathinibhargavaram7126
@bathinibhargavaram7126 3 ай бұрын
Thank you so much mam🙏🤗..
@jarpalasony6569
@jarpalasony6569 2 жыл бұрын
Mam could you please upload a video on malloc( ) with structures
@18_ayushmishra62
@18_ayushmishra62 2 жыл бұрын
Inhi topic malloc calloc k liye to c dekhna chalu kiya aur 1 mahine se last topic khatm kar k baitha hu aur aj jak ispe video aya
@RiyaRoy-qi6tk
@RiyaRoy-qi6tk 2 жыл бұрын
mam why we use calloc ?? what is need of calloc ?? why we need multiple block of memory 😐🤔🤔
@bhanuprasad9788
@bhanuprasad9788 2 жыл бұрын
Continue mam never stop
@premwagh9480
@premwagh9480 2 жыл бұрын
why i'm reminding to priya gill after watching ma'am😄😄
@DaniyelTutorials
@DaniyelTutorials 2 жыл бұрын
Beautiful Lecture
@hareeshkumar7570
@hareeshkumar7570 2 жыл бұрын
Mam I'm from Pakistan and I'm in 1st semester watching your lectures but it is in c language while we are learning c++ so getting some difficulty to understand. Would you please make some lectures on object oriented programming in c++ because we are to Confused in it
@RahulBisht_001
@RahulBisht_001 2 жыл бұрын
Tumhe bomb banana nahi sikhate 😂😂😂😂
@aryanvyas2836
@aryanvyas2836 2 жыл бұрын
@@RahulBisht_001 bruhh
@sanjays7255
@sanjays7255 2 жыл бұрын
Never give up for you dreams bro 👍
@_hindu_warriors
@_hindu_warriors 2 жыл бұрын
Return to ur motherland hindu boy
@farzanaashraf8136
@farzanaashraf8136 2 жыл бұрын
@@RahulBisht_001 😂
@SairamTheegala
@SairamTheegala 2 жыл бұрын
ur awesome 💯
@RahulYadav-hr7bx
@RahulYadav-hr7bx 2 жыл бұрын
Mam if possible make a separate video on STATIC variable ,,, because it is very confusing
@therash09
@therash09 2 жыл бұрын
static means that the variable (even local) remains for the lifetime of the program and is not destroyed. Its accessibility is limited to the scope where it is defined (like function or file), but its value is not reinitialized during any access after the first access since the variable remains preserved throughout the code lifetime. If you initialize a local variable x in a function as static int x=0, and then increment it by 1 in each call of this function, then your outputs after five function calls will be 1,2,3,4,5. This is because static x retains its value from the last function call and is not reinitialized to 0, since x is not destroyed at the end of every function call. If, however, you declare x as an auto variable by simply doing int x=0, and call the function five times, then your output will be 1,1,1,1,1. This is because the auto variable will be reinitialized to 0 in each function call, as it will have been destroyed at the end of the previous function call. So, static preserves the variable even after your function and its local auto variables have been popped out of stack since static variables are not stored on stack, and therefore remain till the end of the program, thereby retaining their value. So, they behave like global variables but with their accessibility limited to the function in which they are defined. You can expand this understanding to multiple files in a program too. It is good to define variables as static locally to limit their accessibility to the function or file of interest, instead of declaring them as global. Static will preserve the variable values the same way as global, but limit the variable accessibility, which is good!
@Sumit_152
@Sumit_152 2 жыл бұрын
Mam can you teach us competetive programing please
@TanujGutta-r3k
@TanujGutta-r3k Ай бұрын
In malloc memory is allocated to single block whereas in calloc multiple blocks are allocated with same memory
@meghanakuppala
@meghanakuppala 2 жыл бұрын
Very nice 🙂
@pobbathisuryanarayana3752
@pobbathisuryanarayana3752 2 жыл бұрын
Malloc with structures make a separate video mam
@asifshinwari1552
@asifshinwari1552 2 жыл бұрын
wow in the black cloths you look so pretty
@CodingKitchen
@CodingKitchen 2 жыл бұрын
Thank you
@1shAggarwal
@1shAggarwal 2 жыл бұрын
Kal paper hai, or poori c language ki theory , or sab aa rha hai, or ye topic ab dala😔
@navinvenkat3404
@navinvenkat3404 2 жыл бұрын
while i code assignment which was given by mam there is some error while executing it can anybody post that assignment code which was given by mam pls,,
@errorless7921
@errorless7921 2 жыл бұрын
Thanku very much mam
@A_M_A_N794
@A_M_A_N794 2 жыл бұрын
thanks a lot
@chetnawadhwa4345
@chetnawadhwa4345 2 жыл бұрын
Thank you mam
@abdulrahimjalloh363
@abdulrahimjalloh363 Жыл бұрын
Madam Jenny is Ada Lovelace 2 🥰
@nikithaa.s683
@nikithaa.s683 Жыл бұрын
Can you please say why we don't use calloc fuction while dynamically allocating memory for structures
@Vinayvarma_25
@Vinayvarma_25 Ай бұрын
Mam but we can do this like Scanf("%d",&n); a[n]; //instead of malloc mam
@shubhamitaliya3561
@shubhamitaliya3561 Жыл бұрын
amazing
@56vaibhavjadhav36
@56vaibhavjadhav36 2 жыл бұрын
Hii ma'am Data structure and algorithm series is completed or some videos are coming.......
@Euphony_Pro
@Euphony_Pro Жыл бұрын
i getting 0 for malloc function also. it is not generating and random garbage values
@surajkumarchaubey210
@surajkumarchaubey210 2 жыл бұрын
Nice mam
@udaysinghrana5725
@udaysinghrana5725 Жыл бұрын
Assignment Question - #include #include void main() { int *ptr,n,i; printf(" How many values for calloc:"); scanf("%d",&n); ptr = (int*) calloc(n,sizeof(int)); for(i=0;i
@abhisheksahu7643
@abhisheksahu7643 Жыл бұрын
Mam ap vs code ka konsa verson use karti ho
@basuhosur-nh4di
@basuhosur-nh4di Жыл бұрын
Why not coming the garbage value and zero value mam?
@trendingmonkey5759
@trendingmonkey5759 2 жыл бұрын
Please tell the syllabus for gate exam mam now I am studying 1st year and I don't know what are the syllabus please help me mam I am from poor family I need to crack gate
@Mohan-im5wr
@Mohan-im5wr Ай бұрын
😊😊
@beautyofnature4757
@beautyofnature4757 Жыл бұрын
I love you
@sikiodi5212
@sikiodi5212 2 жыл бұрын
Mam. Pls upload a topic regarding operator overloading in c++
@nitishgarg657
@nitishgarg657 2 жыл бұрын
Mam how many lectures left
@ajaytiwari6286
@ajaytiwari6286 2 жыл бұрын
Mam please start java or c++with c
@rphanidattu1515
@rphanidattu1515 2 жыл бұрын
❤️
@swamy56
@swamy56 2 жыл бұрын
Why calloc intialized with ZERO& where malloc as GARBAGE???
@keerthibindu2455
@keerthibindu2455 2 жыл бұрын
Mam can you right and show me imp points
@dhavalgondaliya8707
@dhavalgondaliya8707 2 жыл бұрын
C language me abhi kitana baki hai ?
@YDK_Edits
@YDK_Edits 2 жыл бұрын
Mam...you are so #beautiful ..
@ronycb7168
@ronycb7168 4 ай бұрын
Looks like they ran out of names when it came to naming calloc...
@cbcearth5056
@cbcearth5056 2 жыл бұрын
Maddam will you choose better explaining
@dipoyadav5665
@dipoyadav5665 Жыл бұрын
Write a program to multiply given to matrices of order (Mxn) and (PxQ) using pointer Mam makes this program video in c programming
@eiji2.025
@eiji2.025 2 жыл бұрын
Mam Yogi Ji Jeet Gye
@GowripriyaKuncha
@GowripriyaKuncha 16 күн бұрын
Not clear view after 10 minutes
@ffdf2195
@ffdf2195 2 жыл бұрын
ttttttttoooooooooppppppp
@souviklayek2581
@souviklayek2581 Жыл бұрын
#include #include int main (){ int i,n,*ptr;float*current; printf("Enter the value of n "); scanf("%d",&n); ptr=(int*)malloc(sizeof(int)); printf("Enter the values "); for(i=0;i
@tejhimanshu
@tejhimanshu 2 жыл бұрын
#include #include void main() { int *ptr, n, m, i, sum = 0; float *ptr1, avg = 0, avg_sum = 0; printf("enter total no of values for calloc: "); scanf("%d", &n); ptr = (int *)calloc(n, sizeof(int)); if (ptr == NULL) { printf("memory allocation failed..."); } printf("enter values: "); for (i = 0; i < n; i++) { scanf("%d", (ptr + i)); sum = sum + *(ptr + i); } printf("Sum = %d ", sum); free(ptr); printf("enter total no of value for malloc: "); scanf("%d", &n); ptr1 = (float *)malloc(n * sizeof(float)); if (ptr1 == NULL) { printf("memory allocation failed..."); } printf("enter values: "); for (i = 0; i < n; i++) { scanf("%f", (ptr1 + i)); avg_sum = avg_sum + *(ptr1 + i); } avg = avg_sum / n; printf("Average = %.2f", avg); free(ptr1); }
@atifreza4607
@atifreza4607 2 жыл бұрын
in alloc also im getting 0 value im not getting garbage value in malloc #include #include // malloc is stands for memory allocation int main(){ int n,*p,i; printf("Enter the no u want to insert "); scanf("%d",&n); p=(int *)malloc(n*sizeof(int)); // printf("Enter the values "); // for(i=0;i
@Manpreet_saini696
@Manpreet_saini696 Жыл бұрын
// Online C compiler to run C program online #include // Online C compiler to run C program online #include #include #include void main() { int n,i,*ptr; printf("no of values:"); scanf("%d",&n); ptr=(int*)calloc(n,sizeof(int)); printf("values are:"); for(i=0;i
@Tech_Gyan.21
@Tech_Gyan.21 Жыл бұрын
We can't use Integer pointer to store address of floating value.
@abdulrahimjalloh363
@abdulrahimjalloh363 Жыл бұрын
Thanks mam
@aparnamane4899
@aparnamane4899 2 жыл бұрын
Malloc with structures make a separate video mam plz
C_135 Dynamic Memory Allocation using realloc() | C Language Tutorials
18:10
Jenny's Lectures CS IT
Рет қаралды 88 М.
C_133 Dynamic Memory Allocation using malloc() | C Language Tutorials
23:44
Jenny's Lectures CS IT
Рет қаралды 222 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
C_119 File Handling in C - part 1 | Introduction to Files
12:15
Jenny's Lectures CS IT
Рет қаралды 375 М.
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,5 МЛН
i wrote my own memory allocator in C to prove a point
5:23
Low Level
Рет қаралды 408 М.
C_132 Introduction to Dynamic Memory Allocation in C  | SMA vs DMA
17:38
Jenny's Lectures CS IT
Рет қаралды 289 М.
Static Memory vs Dynamic Memory | C Language Tutorial
16:30
Naresh i Technologies
Рет қаралды 271 М.
C_138 Enumeration in C | enum data type in C Language
19:34
Jenny's Lectures CS IT
Рет қаралды 96 М.
Dynamic memory allocation in C - malloc calloc realloc free
17:35
mycodeschool
Рет қаралды 891 М.
Dynamic Memory Allocation | C Programming Tutorial
31:51
Portfolio Courses
Рет қаралды 96 М.