Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INSTRUCTOR SUPPLIED DRIVER FILE: #define INSTRUCTOR_FILE #ifdef INSTRUCTOR_FILE #include #include int (*GetPrintfPointer(void))(const char *format, ...); int (*GetPutsPointer(void))(const char *str); int main(void) { int rtnPrintf =

image text in transcribed

INSTRUCTOR SUPPLIED DRIVER FILE:

#define INSTRUCTOR_FILE #ifdef INSTRUCTOR_FILE

#include #include

int (*GetPrintfPointer(void))(const char *format, ...); int (*GetPutsPointer(void))(const char *str);

int main(void) { int rtnPrintf = GetPrintfPointer()("Testing %s %x %d %o ", "\"printf\"", 25, 25, 25);

int rtnPuts = GetPutsPointer()("Testing \"puts\"");

printf("printf returned %d; puts returned %d ", rtnPrintf, rtnPuts);

return EXIT_SUCCESS; } #endif

image text in transcribed
See attached for clearer picture
C2A6E1 (2 points - Program) Exclude any existing source code files that may already be in your IDE project and add a new one, naming it C2A6E1_GetPointers.c. Also add instructor-supplied source code file C2A6E1_main-Driver.c. Do not write a main function! main already exists in the instructor-supplied file and it will use the code you write. File C2A6E1_GetPointers.c must contain functions named GetPrintfpointer and Get PutsPointer. GetPrintfpointer syntax: int (*GetPrintfpointer(void))(const char *format, ...); Parameters: none Synopsis: Declares a pointer named pPrintf of appropriate type to point to the standard library printf function and initializes it to point to that function. It does all of this in one single statement. Return: the initialized pointer named printf, which points to the standard library printf function GetPutsPointer syntax: int (*GetPutsPointer(void)) (const char *str); Parameters: none Synopsis: Declares a pointer named puts of appropriate type to point to the standard library puts function and initializes it to point to that function. It does all of this in one single statement. Return: the initialized pointer named pPuts, which points to the standard library puts function Never explicitly write a prototype for a library function. Instead, use #include to include the appropriate standard library header file. It will aiready contain the needed prototype. The GetPrintfpointer and GetputsPointer functions must each contain two and only two statements: 1. The statement that declares and initializes the pointer. 2. The statement that returns the pointer. Submitting your solution Send both source code files to the assignment checker with the subject line C2A6E1_ID, where ID is your 9-character UCSD student ID See the course document titled "How to Prepare and Submit Assignments" for additional exercise formatting submission, and assignment checker requirements. Hints: Look up the standardi library printf and puts functions in your IDE's built-in help, any good C programming text book, or online, and examine their prototypes. none C2A6E1 (2 points - Program) Exclude any existing source code files that may already be in your IDE project and add a new one. naming it C2A6E1 GetPointers.c. Also add instructor-supplied source code file C2A6E1_main-Driver.c. Do not write a main function main already exists in the instructor-supplied file and it will use the code you write. File C2A6E1_GetPointers.c must contain functions named GetPrintfpointer and Get PutsPointer. GetPrintfPointer syntax int ("GetPrintfPointer(void))(const char *format, ...); Parameters: Synopsis: Declares a pointer named pPrintf of appropriate type to point to the standard library printf function and initializes it to point to that function. It does all of this in one single statement. Return: the initialized pointer named pPrintf, which points to the standard library printf function GetPutsPointer syntax int ("GetPutsPointer(void)) (const char *str); Parameters: none Synopsis: Declares a pointer named pPuts of appropriate type to point to the standard library puts function and initializes it to point to that function. It does all of this in one single statement. Return: the initialized pointer named pPuts, which points to the standard library puts function Never explicitly write a prototype for a library function. Instead, use #include to include the appropriate standard library header file. It will already contain the needed prototype. The GetPrintfPointer and GetPutsPointer functions must each contain two and only two statements: 1. The statement that declares and initializes the pointer. 2. The statement that returns the pointer. Submitting your solution Send both source code files to the assignment checker with the subject line C2A6E1_ID. where ID is your 9-character UCSD student ID See the course document titled "How to Prepare and Submit Assignments for additional exercise formatting, submission, and assignment checker requirements. Hints: Look up the standard library printf and puts functions in your IDE's built-in help. any good C programming text book, or online, and examine their prototypes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions