#include<stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}

Tell me the output?

Answers were Sorted based on User's Feedback



#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) m..

Answer / fazlur rahaman naik

The output will b : RamcoSystems

Is This Answer Correct ?    17 Yes 0 No

#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) m..

Answer / sumant

the output will be RamcoSystems
but we need 2 more libraries
#include<string.h> and
#include<alloc.h>
to run this program. in else case it will not work.

Is This Answer Correct ?    6 Yes 0 No

#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) m..

Answer / mage

The program is not correct. What is present in memory
beyond "Ramco" is not known and we are trying to
attach "Systems". May be we are overwriting something which
is unsafe.

To concatenate two strings declare the first as array.

example: char p1[50];
char *p2;
p2 = malloc(25);
strcpy(p1, "Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);

Is This Answer Correct ?    7 Yes 1 No

#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) m..

Answer / v.srinivasan

#include<stdio.h>

main()
{
char *p1,*p2;
p1 = (char *)malloc(25);
p2 = (char *)malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}



the output will be RamcoSystems

we don't need the following libraries under Linux 2.6
#include<string.h> and
#include<alloc.h>
to run this program.

Is This Answer Correct ?    5 Yes 0 No

#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) m..

Answer / khaja

ramco system

Is This Answer Correct ?    3 Yes 1 No

#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) m..

Answer / mastan vali.shaik

25Ramco25Systems

Is This Answer Correct ?    2 Yes 13 No

Post New Answer

More C Interview Questions

List a few unconditional control statement in c.

0 Answers  


how to create c progarm without void main()?

1 Answers   NIIT,


Is it cc or c in a letter?

0 Answers  


What are types of preprocessor in c?

0 Answers  


char ch="{'H','I',0};printf("%s",ch);what is output

9 Answers   Accenture,






what are far pointers?

1 Answers  


plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>

1 Answers  


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

0 Answers   HCL,


What is call by reference in functions?

1 Answers  


Explain #pragma statements.

0 Answers  


Give a fast way to multiply a number by 7

15 Answers   Accenture, Aricent, Microsoft,


what is diff b/w huge & far & near pointer??

1 Answers   HCL,


Categories