Podcast
Questions and Answers
What is an array?
What is an array?
Where are the data items of an array stored in memory?
Where are the data items of an array stored in memory?
How should an array be declared before use?
How should an array be declared before use?
What is the range of an array with n elements?
What is the range of an array with n elements?
Signup and view all the answers
How can arrays be initialized at compile time?
How can arrays be initialized at compile time?
Signup and view all the answers
What is the syntax for declaring an array?
What is the syntax for declaring an array?
Signup and view all the answers
What type of values can array elements be initialized with?
What type of values can array elements be initialized with?
Signup and view all the answers
int arr[5];
What does this code initialize?
int arr[5];
What does this code initialize?
Signup and view all the answers
{1, 2, 3, 4}
How are these values represented in an array initialization?
{1, 2, 3, 4}
How are these values represented in an array initialization?
Signup and view all the answers
float numbers[10];
What does this code declare?
float numbers[10];
What does this code declare?
Signup and view all the answers
What happens if the number of values to be initialized is more than the size of the array in C language?
What happens if the number of values to be initialized is more than the size of the array in C language?
Signup and view all the answers
When an array is partially initialized in C, what happens to the remaining elements?
When an array is partially initialized in C, what happens to the remaining elements?
Signup and view all the answers
What does the C compiler do if an array is initialized with all zeros?
What does the C compiler do if an array is initialized with all zeros?
Signup and view all the answers
What is the size of array 'b' in the declaration 'char b[]={'C','O','M','P','U','T','E','R'};'?
What is the size of array 'b' in the declaration 'char b[]={'C','O','M','P','U','T','E','R'};'?
Signup and view all the answers
In string initialization of an array in C, what character ends the string?
In string initialization of an array in C, what character ends the string?
Signup and view all the answers
What will happen if you initialize an array in C without specifying the size directly?
What will happen if you initialize an array in C without specifying the size directly?
Signup and view all the answers
How does run time initialization of an array differ from compile time initialization in C?
How does run time initialization of an array differ from compile time initialization in C?
Signup and view all the answers
If you declare 'int ch[]={1,0,3,5};', what will be the size of the array 'ch'?
If you declare 'int ch[]={1,0,3,5};', what will be the size of the array 'ch'?
Signup and view all the answers
'char b="COMPUTER";' - Is this a correct way to initialize a character array in C?
'char b="COMPUTER";' - Is this a correct way to initialize a character array in C?
Signup and view all the answers
'int a={9,2,4,5,6};' - What error will be encountered with this initialization?
'int a={9,2,4,5,6};' - What error will be encountered with this initialization?
Signup and view all the answers