Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Working with switch case



Iterative statement



" ; " after loop



Comment



Specifer




String_ CMP - strcat function




// AHF C PROGRAM SOLVING

//solving here CHARACTER MANIPULATION FUNCTION ( CMP ) 	programming problem

#include<stdio.h> #include<string.h> #define pf printf int main() { char str1[500],str2[100]; //taking first data pf("Enter first string: "); gets(str1); //taking second data pf("\nEnter second string: "); gets(str2); //concatenate first and second data strcat(str1,str2); //showing output pf("\nThe concatenation of two string is: %s",str1); return 0; }
After changing function:
#include<stdio.h> #include<string.h> #define pf printf int main() { char str1[500],str2[100]; //taking first data pf("Enter first string: "); gets(str1); //taking second data pf("\nEnter second string: "); gets(str2); //concatenate first and second data strcat(str2,str1); //showing output pf("\nThe concatenation of two string is: %s",str2); return 0; }
OUTPUT:


© 2018 - All rights reserved