I start learning C mode, I already read the tutorial but i was unable to find out the use of strcpy function. Can any one explain me C String Manipulation.Any help will be extremely appreciated.
I start learning C mode, I already read the tutorial but i was unable to find out the use of strcpy function. Can any one explain me C String Manipulation.Any help will be extremely appreciated.
The C programming language offers a library function called strcpy, defined in the string.h header file, that allows null-terminated memory blocks to be copied from one location to another.String manipulation is very useful and very widely used in every language. The strcpy() function shall return s1; no return value is reserved to indicate an error.
The function strlen() will tell you the number of characters in a string. use a for loop to print out a string the user enters with a * between each letter. String objects are a special type of container, specifically designed to operate with sequences of characters. StrCpy Function, Copies one string to another.
Code:#include <stdio.h> #include <string.h> int main() { char dem[] = "H Word"; char * he_it_is; dem[5] = '\0'; printf ("%s\n",dem); printf ("%d\n",strlen(dem)); here_it_is = &dem[1]; printf ("%s\n",he_it_is); }
Bookmarks