Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Will Coast
- //CS 2060.002
- //Assignment 5
- //Due 20 November 2018\
- //long desc
- #include <stdio.h>
- void printArray(char * arrayPtr);
- int main () {
- char * arrayPtr[] = {"echo","charlie","delta","alpha","beta"};
- //welcome message + description of program
- printf("Welcome to Will Coast's array of string pointers assignment.\nIn this program, we will first print "
- "our predetermined, unsorted array. \nWe will then sort it alphabetically with a sorting function and reprint it with the same print function.\n");
- printf("We will do this by using a while loop inside a for loop inside our print function.\n");
- printArray(*arrayPtr);
- //sortArray
- //printArray;
- return 0;
- }
- void printArray (char * arrayPtr) {
- for (int i = 0; i < 30; i++) {
- char *temp = &arrayPtr[i];
- if(arrayPtr[i] == '\0'){
- printf("\n------\n");
- continue;
- }else{
- printf("%c/", arrayPtr[i]);
- }
- //this while loop prints the word letter by letter until it runs into a nul character.
- // while (*temp != '\0') {
- // printf("%c", *(temp));
- // temp++;
- // }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement