-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrings.cpp
More file actions
25 lines (18 loc) · 874 Bytes
/
Strings.cpp
File metadata and controls
25 lines (18 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
//Here the strings were loaded with the help of the library 'cstring' being included in the program.
#include<cstring>
using namespace std;
int main()
{
//The '[]' represents the string place and is used with a vairable to denote the same.
char c1[] = "Great";
char c2[] = " Guy";
//Note: If the '[]' is not used the char command will only be expected to take in single character. Hence, showing the error while execution.
//In Concatenation, the strings are written together as they are.
cout<<"Concatenation: "<<strcat(c1,c2)<<"\n";
//In Copy, the string c2 will be copied in string c1.
cout<<"Copy: "<<strcpy(c1,c2)<<"\n";
//The Length of the string is given by strlength function. To find the length of a string, use 'strlength(c1)' or 'strlength(c2)'.
cout<<"Length: "<<strlen("ABC")<<"\n";
return 0;
}