Explain the difference between malloc() and calloc() in c?
Answer / Rahul Shastri
Both malloc() and calloc() are used to dynamically allocate memory in C. The main difference is that calloc() initializes the allocated memory with zeroes, while malloc() does not. Also, calloc() takes into account the number of elements being allocated, making it more convenient for arrays.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is Bitwise Operator and how it works?
What is a list in c?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
for (i <= 5 && i >= -1;++i; i > 0) { printf("%d ", i); }
Is there any data type in c with variable size?
#include<conio.h> #include<stdio.h> void main() { int i; if(1,0,2,3) { printf("if"); } else { printf("else"); } getch(); } Can any body tell the answer of this question with explanation?
Switch (i) i=1; case 1 i++; case 2 ++i; break; case 3 --i; Output of i after executing the program
What math functions are available for integers? For floating point?
What is a structure member in c?
study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Can we increase size of array in c?
write a program to display all prime numbers