st08-array

St08-array - CSC 1111 Introduction to Computing using C Arrays(Self-test questions 1 Array Initialization int foo[10 = cfw 10 9 8 7 int bar = cfw 1

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CSC 1111 Introduction to Computing using C++ Arrays (Self-test questions)
Background image of page 1

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

View Full DocumentRight Arrow Icon
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?
Background image of page 2
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) { … }
Background image of page 3

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

View Full DocumentRight Arrow Icon
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) { … }
Background image of page 4
5 2-D Array Can you declare a 3x10 2-D array in C++ with
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/28/2010 for the course CSC CSC1110 taught by Professor Cjyuan during the Fall '06 term at CUHK.

Page1 / 11

St08-array - CSC 1111 Introduction to Computing using C Arrays(Self-test questions 1 Array Initialization int foo[10 = cfw 10 9 8 7 int bar = cfw 1

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online