Strings

Q1: What will be the output of the program (Turbo C in 16 bit platform DOS) ?
#include<stdio.h>
#include<string.h>

int main()
{
    char *str1 = "India";
    char *str2 = "Aptitude";
    char *str3;
    str3 = strcat(str1, str2);
    printf("%s %s\n", str3, str1);
    return 0;
}

A AptitudeCrack India

B AptitudeCrack AptitudeCrack

C India India

D Error

ANS:B - AptitudeCrack AptitudeCrack

It prints 'AptitudeCrack AptitudeCrack' in TurboC (in 16 bit platform). It may cause a 'segmentation fault error' in GCC (32 bit platform).



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.