[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: Dynamic Memory Allocation - Discussion

Home > C Programming > Dynamic Memory Allocation > MCQs Questions Discussion

10 / 18

What will be output of the following "c" code?

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
char *p = "Hello";
char *q = "world";
int l1 = strlen (p);
int l2 = strlen (q);
char *l = (char*) malloc (sizeof (l1 + l2)+1);
while (*p) *l++ = *p++;
while (*q) *l++ = *q++;
*l = '\0'; 
}

ASegmentation Fault

BCompilation Error

CNo output No Error

DNone of these

Answer: Option (Login/Signup)

Show Explanation

Asked In ::

Post Your Answer Here:     

No Discussion on this question yet!