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?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to find the given number is prime or not

4662


What are bitwise shift operators in c programming?

1040


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1772


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

1016


What are different types of operators?

994


How can I implement sets or arrays of bits?

990


When should a type cast not be used?

1008


Explain can you assign a different address to an array tag?

1017


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

2302


What are Macros? What are its advantages and disadvantages?

1094


What is a nested formula?

1057


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

1057


What is NULL pointer?

1044


difference between Low, Middle, High Level languages in c ?

2028


Is there a built-in function in C that can be used for sorting data?

1184