In-Class Practice
String Output
Consider the following incomplete program that
displays the string "This is a string".
Add code to:
-
allocate memory for the string
-
initialize that memory to hold the phrase
-
pass the string to the display() function
-
in the display() function,
send the string to the standard output stream so that the string appears left-justified
in a field of 20 characters
// String Output
// stringOutput.c
#include <stdio.h>
int main(void)
{
display( );
return 0;
}
void display( )
{
} |
|