11. Look at the Code:
#include<string.h>
void main()
{
char s1[]="abcd";
char s2[10];
char s3[]="efgh";
int i;
clrscr();
i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd"));
printf("%d",i);
}

What will be the output?
A)No output B) A Non Integer C)0 D) Garbage

Answer Posted / anand

#include<string.h>
main()
{
char s1[]="abcd";
char s2[10];
char s3[]="efgh";
int i;
i=strcmp(strcat(s3,strcpy(s2,s1)),strcat(s3,"abcd"));
//i=strcmp(strcat(s3,strcpy(s2,s1))strcat(s3,"abcd"));
printf("%d",i);
return 0;
}

ans:0
strcpy(efgh,abcd)=efghabcd
strcat(efgh,abcd)=efghabcd

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to have a function as a parameter in another function?

592


Explain 'bus error'?

546


what is the structure pointer?

1637


What is data structure in c and its types?

584


What is use of pointer?

578






How do I create a directory? How do I remove a directory (and its contents)?

598


What are preprocessor directives in c?

628


What are the advantages of c preprocessor?

699


How to find a missed value, if you want to store 100 values in a 99 sized array?

803


What is #define size in c?

637


Can we access the array using a pointer in c language?

554


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1505


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

644


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1302


What does sizeof function do?

606