Commvault Written Test Qs.(Technical Aptitude) :: Dynamic Memory Allocation - Discussion
Home > Freshers Archives > Commvault Placement Questions & Answers > MCQs Questions Discussion
3 / 40
What is the output of the program on a 32 bit Operating System?
#include
#include
void main () {
double val = 12.34;
double *dp = &val;
char *cp;
cp = (char*)malloc(sizeof(char) * 20);
sprintf (cp, "hello world");
printf("%d %d %d", sizeof(cp), sizeof(dp), sizeof(val));
}
#include
void main () {
double val = 12.34;
double *dp = &val;
char *cp;
cp = (char*)malloc(sizeof(char) * 20);
sprintf (cp, "hello world");
printf("%d %d %d", sizeof(cp), sizeof(dp), sizeof(val));
}
A4 4 8
B20 8 8
C11 8 8
D20 4 8
Answer: Option (Login/Signup)
Show Explanation
size of char in c is 8 bytes
size of double in c is 8 bytes
size of double in c is 8 bytes
Asked In ::
TRICK
size of char in c is 8 bytes
size of double in c is 8 bytes
size of double in c is 8 bytes
Read Full Answer
Report Error
Please Login First Click Here