Note: don't worry if you can't finish the entire lab exercise. Use turnin (see step 6) to turn in as much as you've completed before you leave the lab. Make sure you finish the rest of the lab on your own time.
lab4.c
:
/* Lab 4 Double all characters in a string YOUR NAME YOUR SECTION NUMBER */ #include <stdio.h> /* HERE IS THE FUNCTION PROTOTYPE */ void doubleAll (const char stringa[], char stringb[]); int main() { char instring[40]; char outstring[80]; printf ("Please enter a string: "); fgets (instring, 40, stdin); /* PUT YOUR FUNCTION CALL HERE */ printf ("with characters doubled: "); puts(outstring); return 0; } /* PUT YOUR FUNCTION DEFINITION HERE */ /* REFER TO THE PROTOTYPE FOR THE FUNCTION HEADING */
Please enter a string: are we having fun yet? With letters doubled: aarree wwee hhaavviinngg ffuunn yyeett??If you are running out of time, skip ahead to step 6, and complete step 5 on your own time. If you have at least 15 minutes left, proceed to step 5.
void doubleAll(const char *stringa, char *stringb);Change the function heading to match the prototype. Change the body of the function so that it does not use array subscripts to access the elements of the array, but uses pointers instead. Your function call will remain the same as before.
/cs/bin/turnin submit cs2301 LAB4 lab4.c
See you in two weeks (Thanksgiving break starts next Wednesday)!