Strings in C are represented by array of characters. The end of a string is marked by a special character called null character ‘\0’.
String handling library functions are:
String handling library functions are:
- strlen(name); →finds the length of string.
- strcpy(s1,s2); →copy s2 to s1;
- strcat(s1,s2); →concatenate s1&s2 (s1=s1+s2)
- strcmp(s1,s2);→compares s1 & s2 (0 if equal, else non zero number).
Declaration and initialization :
- char name[30];
- char name[30] = “Hello welcome”;
- char name[]= {‘H’,’e’,’l’,’l’,’o’,’ ‘,’w’,’e’,’l’,’c’,’o’,’m’,’e’};
No comments:
Post a Comment
Guys if you think something is wrong or should be edit than please do comment.