Day 4: Arrays and Strings

Source: Internet
Author: User

Array
 
Fixed number of elements of the same type stored sequentially in memory
Initialization, or unexpected results
Arrays are passed by reference
Multidimen1_arrays are merely an unsupported action for programmers, as all the elements in the array are sequential in memory
 
String
 
Simply a character array and can be manipulated as such
Char hello [] = {h, e, l, l, o ,,}
Char hello = "hello"
Cpp Code
# Include <iostream>
# Include <cstring>
Using namespace std;

Int main (){
Char fragment1 [] = "Im a s ";
Char fragment2 [] = "tring! ";
Char fragment3 [20];
Char finalString [20] = "";

Strcpy (fragment3, fragment1 );
Strcat (finalString, fragment3 );
Strcat (finalString, fragment2 );

Cout <finalString;
Return 0;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.