Skip to content
Snippets Groups Projects
Commit abca458c authored by Miguel Espino's avatar Miguel Espino
Browse files

fixed warnings from these files

parent ce67f705
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ int myGetline(char s[], int lim)
for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
s[i] = c;
if (c = '\n')
if (c == '\n')
{
s[i] = c;
++i;
......@@ -25,21 +25,21 @@ int myGetline(char s[], int lim)
}
int *readlines(char *lineptr[], int maxlines)
int readlines(char *lineptr[], int maxlines)
{
int len, *nlines;
int len, nlines;
char *p, line[MAXLEN];
*nlines=0;
nlines=0;
while ((len = myGetline(line, MAXLEN)) > 0)
{
if (*nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
return NULL;
if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
return 0;
else
{
line [len-1] = '\0';
memmove(p, line, len);
lineptr[*nlines++] = p;
lineptr[nlines++] = p;
}
}
......@@ -48,7 +48,6 @@ int *readlines(char *lineptr[], int maxlines)
void writelines(char *lineptr[], int nlines)
{
int linenum;
while (nlines-- >0)
printf("%s\n", *lineptr++);
}
......@@ -45,16 +45,16 @@ int main(int argc, char *argv[])
if ((nlines = readlines(lineptr, MAXLINES)) >=0)
if ((nlines = *(int *)readlines(lineptr, MAXLINES)) >=0)
{
printf("UNSORTED ORDER\n");
writelines(lineptr, nlines);
writelines(*lineptr, nlines);
myQsort ((void **)lineptr, 0, nlines-1, comparing);
printf("\nSORTED ORDER \n");
writelines(lineptr, nlines);
writelines(*lineptr, nlines);
return 0;
}
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment