initial import
[staff/goc4/2018bti7061.git] / c-4-pointers / examples / c-pointers / multidimentionarray2.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #define MAXSIZE 12
6
7 void sort(int size, char* x[]);
8
9 int main(){
10 int i,n=0;
11 char *arrayOfStrings[10];
12
13 puts("Enter each string on a separate line");
14 puts("Type control D to finished");
15 int max=10;
16 int size;
17 do{
18
19 arrayOfStrings[n]=(char*) malloc(MAXSIZE * sizeof(char));
20 scanf("%s",arrayOfStrings[n]);
21 size = strlen(arrayOfStrings[n]);
22 n++;
23 }while(size > 0);
24
25 sort(--n,arrayOfStrings);
26
27 printf("List of strings (after sort)\n");
28 for(i=0;i<n;i++){
29 printf("%d) %s\n",(i+1),arrayOfStrings[i]);
30 }
31
32 }
33 /* Should sort, function to be written in exercise */
34 void sort(int size, char* x[]){
35 return;
36 }