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

What is the difference between array and linked list in c?

1077


What is conio h in c?

998


What is #include cctype?

1068


What is a c token and types of c tokens?

1007


please give me some tips for the placement in the TCS.

2050


Write a C program to count the number of email on text

1849


Why can arithmetic operations not be performed on void pointers?

980


How can I do peek and poke in c?

1029


What are derived data types in c?

1007


Differentiate between static and dynamic modeling.

1046


Why we use void main in c?

1093


What is extern storage class in c?

937


What is the correct declaration of main?

1152


Explain what is meant by 'bit masking'?

1116


What is anagram in c?

868