You are on page 1of 1
“Take Home” Exercises (Optional) Lab1c — Using Printf If you want to use printf) to output the value of y, two steps are required. Lab 1c: Using Printf 1, #include short funcl (short *m, short count); short a[4] = (40,39,38,37); int y = 0; nain() t y = function(); printf ("y = #x hex\n", y); , 1, Open labL pit project, if it is not still open. 2. Open the labl.¢ file by double-clicking on it in the Project Explorer window. 3. To use printf) ‘+ First you must remember to include the header file as in step #1 in the above graphic. ‘© Next, you must add the print{{) command to your ¢ file. For example, try adding a simple printf() to main. PlockSine (abuffor, PUFFSIZE) buffer with sine daca prinsf ("Buffer (at location Oxtx) wae filled with sine values\a", gBuffer) : 4, Build and load the .OUT file. ‘When you build and load this program, the Build/Messages window will add a third tab called Stdout which will contain the output from printf. 5. Verify that it works. ‘This can be done by viewing the printed statement in the output window, Stdout tab of the Output window 6. Close the project. 1-60 (€6416/C6713 DSK One-Day Workshop - Intro to C6000 and CCS

You might also like