Hello, welcome C++ Programmer.
In this tutorial we will learn about C++ string.
There are two types of string representation in C++:
1. C-like characters
2. String
Both types can used C++ built-in function for string. For examples: strcopy(), strcat(), strlen(), etc.
Declare - How to declare string?
String can be declared with these statements:
char str1[] = "Hello World";
char str2[12] = "Hello World";
char str3[] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
char str4[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};>
Access - How to access string?
String can be accessed with two methods:
1. Using variable, if you want to access all elements, or.
2. Using variable name and index, if you want to access specific elements of that string.
Modify - How to modify string?
String can be modified with method:
In this tutorial we will learn about C++ string.
There are two types of string representation in C++:
1. C-like characters
2. String
Both types can used C++ built-in function for string. For examples: strcopy(), strcat(), strlen(), etc.
Declare - How to declare string?
String can be declared with these statements:
char str1[] = "Hello World";
char str2[12] = "Hello World";
char str3[] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
char str4[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};>
Access - How to access string?
String can be accessed with two methods:
1. Using variable, if you want to access all elements, or.
2. Using variable name and index, if you want to access specific elements of that string.
Modify - How to modify string?
String can be modified with method:
Tidak ada komentar:
Posting Komentar