Skip to main content
Engineering LibreTexts

6.3: Exercises

  • Page ID
    35827
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Exercise \(\PageIndex{1}\)

    Write the code to declare an array of 12 single precision real numbers.

    Exercise \(\PageIndex{2}\)

    Write the code to declare an array of 15 eight bit signed integers.

    Exercise \(\PageIndex{3}\)

    Assume that an array of 100 double precision real numbers has been declared and is named points. Write the code to print out the first item of points. Also, write the code to set the last item of points to 0.0.

    Exercise \(\PageIndex{4}\)

    Declare a string called mammal and initialize it to the word woodchuck.

    Exercise \(\PageIndex{5}\)

    Do you see any potential problems with this snippet of initialization code? If so, explain the issues and how they might be corrected.

    char bird;
    
    bird[0]=’s’
    bird[1]=’w’
    bird[2]=’a’
    bird[3]=’l’
    bird[4]=’l’
    bird[5]=’o’
    bird[6]=’w’ 
    

    This page titled 6.3: Exercises is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by James M. Fiore via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.