MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / main

Function main

week04/examples/variable-array.cpp:3–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include <iostream>
2using namespace std;
3int main()
4{
5 int num_array1[5] = {0,1}; // fixed length array, initialized to {0,1,0,0,0}
6 cout << "sizeof(num_array1) = " << sizeof(num_array1) << endl;
7
8 int len = 0;
9 while ( len < 10 )
10 {
11 int num_array2[len]; //variable-length array
12 cout << "len = " << len;
13 cout << ", sizeof(num_array2)) = " << sizeof(num_array2) << endl;
14 len ++;
15 }
16}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected