Ad

Chapter - 9: Arrays

State True or False:


Ad
H
Sections
1
Exercises

(a) Address of a floating-point variable is always a whole number. 
True.


(b) Which of the following is the correct way of declaring a float pointer:
1. float ptr ;
2. float *ptr ;
3. *float ptr ;
4. None of the above 

Ans: 2 float *ptr ;


(c) Add the missing statement for the following program to print 35.

#include<stdio.h>
int main( )
{
    int j, *ptr ;
    *ptr = 35 ;
    printf ( "\n%d", j ) ;
    return 0;
} 

Ans: 

#include<stdio.h>

int main( )
{
    int j, *ptr ;
    *ptr = 35 ;
    j = *ptr;
    printf ( "\n%d", j ) ;
    return 0;
} 

(d) if int s[5] is a one-dimensional array of integers, which of the following refers to the third element in the array?
1. *( s + 2 )
1. *( s + 3 )
3. s + 3
4. s + 2 

Ans: 1. *( s + 2 )

Ad

© 2024 Garbage Valuegarbage value logo