{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

st08-array

# st08-array - CSC 1111 Introduction to Computing using C...

This preview shows pages 1–7. Sign up to view the full content.

1 CSC 1111 Introduction to Computing using C++ Arrays (Self-test questions)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Array Initialization int foo[10] = { 10, 9, 8, 7 }; int bar[] = { 1, 2, 3, 4 }; cout << foo [ 0 ] << endl; cout << foo [ 9 ] << endl; cout << bar [ 1 ] << endl; cout << foo [ bar [ 0 ] ] << endl; What's the size of foo[] and bar[] respectively? What's is the output?
3 Arrays as parameters string foo[1000]; bar(foo, 1000); Which of these definition of function bar() is syntactically correctly? A. void bar(string x[], int n) { … } B. void bar(string x[100], int n) { … } C. void bar(string x[1000], int m) { … } D. int bar(string x[], int foo) { … }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Arrays as parameters string foo[1000][20]; bar(foo, 1000); Which of these definition of function bar() is syntactically correctly? A. void bar(string x[][], int n) { … } B. void bar(string x[100][20], int n) { … } C. void bar(string x[][1000], int m) { … } D. void bar(string x[1000][], int foo) { … }
5 2-D Array Can you declare a 3x10 2-D array in C++ with the following characteristics? 1 st row: Store integer values of type int 2 nd row: Store string objects 3 rd row: Store values of type double

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 Arrays as parameters
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}