Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


#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

What is the method to save data in stack data structure type?

0 Answers  


What is the difference between int main and void main in c?

0 Answers  


how to add numbers without using arithmetic operators.

14 Answers   TCS,


Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….

1 Answers  


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

0 Answers  


Why can't we initialise member variable of a strucutre

1 Answers  


Write a program to print numbers from 1 to 100 without using loop in c?

0 Answers  


writw a program to insert an element in the begning of a doubly linked list

1 Answers  


If null and 0 are equivalent as null pointer constants, which should I use?

0 Answers  


What are the restrictions of a modulus operator?

0 Answers  


write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

0 Answers   Subex,


Here is a neat trick for checking whether two strings are equal

0 Answers  


Categories