字串
char s[] = "Hello World";
char *s = "Hello World";範例:
#include <iostream>
using namespace std;
int main() {
char s1[] = "Hello World";
char *s2 = "Hello World";
cout << "size of s1: " << sizeof(s1) << endl;
cout << "size of s2: " << sizeof(s2) << endl;
}結論
Last updated