String in-built Manipulations (part-1) using C language
#include <stdio.h>
#include <stdlib.h>
#include <string.h> //you must use this Pre-processor to do this in-built Manipulations
int main(void) {
//String concatenate
char str[]="hello";
char str1[]="world";
strcat(str,str1);
printf("concatenated string --> %s",str);
//string concatenate based on size
char str2[]="hello";
char str3[]="world";
strncat(str2,str3,3);
printf("\n concatenated string based on size --> %s",str2);
//String copy
char str4[]="hello";
char str5[]="";
strcpy(str5,str4);
printf("\n Copied String is --> %s",str5);
//String copy based on size
char str6[]="hello";
char str7[20]="";
strncpy(str7,str6,4);
printf("\n Copied String based on size is --> %s",str7);
//String compare
char str8[]="vignesh";
char str9[]="vignesh";
int res=strcmp(str8,str9);
printf("\n Compared String value is --> %d",res);
}
Contact Me:
Instagram : https://www.instagram.com/vignesh_pvk/?hl=en
Mail : 1999vigneshpvk@gmail.com
Support my You tube Channel :
https://www.youtube.com/channel/UCSyYejj1sWGbjm2W94qZCbA?view_as=subscriber