class student { int age; string year; string level string name string course };
for(x = 0; x < ARRAY_SIZE; x++) for(y = 0; y < ARRAY_SIZE-1; y++) if(student.age[y] > student.age[y+1]) { holder = student.age[y+1]; student.age[y+1] = student.age[y]; student.age[y] = holder; }
#include <stdio.h> #include <string.h> #define size 20 struct data{ char name[20]; char course[6]; int age; int year; } students[20]; union temporary{ int age; int year; char name[20]; char course[6]; } holder; main() { int x,limit; int input; do { clrscr(); puts("1..insert data"); puts("2..show data"); puts("3..show data in ascending order by age"); puts("4..show data in ascending order by year"); puts("5..show data in descending order by age"); puts("6..show data in descending order by year"); puts("9..exit"); printf("input choice:"); scanf("%d",&input); switch(input) { case 1: inputdata(); break; case 2: showdata(); break; } }while(input!=9); getch(); return 0; } inputdata() { int limit,x; printf("Size of structure to make? (1-20)\t"); scanf("%d",&limit); if(limit<1 || limit>size) { printf("Input Invalid!"); } else { limit=limit-1; printf("\n\n\nAge Year level Course Name\n"); for(x=0;x<=limit;x++) { scanf("%d",&students[x].age); flushall(); scanf("%d",&students[x].year); flushall(); gets(students[x].course); flushall(); gets(students[x].name); flushall(); } } } showdata() { int limit; int x; printf("This are the items you inputted!"); printf("\nAge Year level Course Name\n"); for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%s",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } getch(); } sort_asc_by_age() { int x,y; for(x = 0; x < size; x++) for(y = 0; y < size; y++) if(students[y].age > students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; holder.name=students[y+1].name; holder.course=students[y+1].course; students[y+1].age=students[y].age; students[y+1].year=students[y].year; students[y+1].name=students[y].name; students[y+1].course=students[y].course; students[y].age=holder.age; students[y].name=holder.name; students[y].year=holder.year; students[y].course=holder.course; } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%s",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } getch(); } sort_asc_by_year() { int x,y; for(x = 0; x < size; x++) for(y = 0; y < size-1; y++) if(students[y].year > students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; holder.name=students[y+1].name; holder.course=students[y+1].course; students[y+1].age= students[y].age; students[y+1].year=students[y].year; students[y+1].name=students[y].name; students[y+1].course=students[y].course; students[y].age=holder.age; students[y].name=holder.year; students[y].year=holder.name; students[y].course=holder.course; } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%s",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } getch(); } sort__desc_by_age() { int x,y; for(x = 0; x < size; x++) for(y = 0; y < size; y++) if(students[y].age < students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; holder.name=students[y+1].name; holder.course=students[y+1].course; students[y+1].age= students[y].age; students[y+1].year= students[y].year; students[y+1].name= students[y].name; students[y+1].course= students[y].course; students[y].age =holder.age; students[y].name =holder.year; students[y].year =holder.name; students[y].course=holder.course; } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%s",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } getch(); } sort_desc_by_year() { int x,y; for(x = 0; x < size; x++) for(y = 0; y < size-1; y++) if(students[y].year < students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; holder.name=students[y+1].name; holder.course=students[y+1].course; students[y+1].age= students[y].age; students[y+1].year= students[y].year; students[y+1].name= students[y].name; students[y+1].course= students[y].course; students[y].age =holder.age; students[y].name =holder.year; students[y].year =holder.name; students[y].course=holder.course; } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%s",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } getch(); }
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: test.c (C) test.c 25 error [Info 718] Symbol 'clrscr' undeclared, assumed to return int test.c 25 error [Info 746] call to function 'clrscr()' not made in the presence of a prototype test.c 37 error [Info 718] Symbol 'inputdata' undeclared, assumed to return int test.c 37 error [Info 746] call to function 'inputdata()' not made in the presence of a prototype test.c 40 error [Info 718] Symbol 'showdata' undeclared, assumed to return int test.c 40 error [Info 746] call to function 'showdata()' not made in the presence of a prototype test.c 42 error [Info 744] switch statement has no default test.c 45 error [Info 718] Symbol 'getch' undeclared, assumed to return int test.c 45 error [Info 746] call to function 'getch()' not made in the presence of a prototype test.c 47 error [Warning 529] Symbol 'x' (line 21) not subsequently referenced test.c 47 error [Warning 529] Symbol 'limit' (line 21) not subsequently referenced test.c 51 error [Info 745] function 'inputdata()' has no explicit type or class, int assumed test.c 51 error [Warning 532] Return mode of function 'inputdata(void)' inconsistent with line 37 test.c 66 error [Warning 534] Ignoring return value of function 'flushall(void)' (compare with line 299, file c:\progra~1\borland\bcc55\include\stdio.h) test.c 68 error [Warning 534] Ignoring return value of function 'flushall(void)' (compare with line 299, file c:\progra~1\borland\bcc55\include\stdio.h) test.c 69 error [Warning 534] Ignoring return value of function 'gets(char *)' (compare with line 179, file c:\progra~1\borland\bcc55\include\stdio.h) test.c 69 error [Warning 421] Caution -- function 'gets(char *)' is considered dangerous test.c 70 error [Warning 534] Ignoring return value of function 'flushall(void)' (compare with line 299, file c:\progra~1\borland\bcc55\include\stdio.h) test.c 71 error [Warning 534] Ignoring return value of function 'gets(char *)' (compare with line 179, file c:\progra~1\borland\bcc55\include\stdio.h) test.c 71 error [Warning 421] Caution -- function 'gets(char *)' is considered dangerous test.c 72 error [Warning 534] Ignoring return value of function 'flushall(void)' (compare with line 299, file c:\progra~1\borland\bcc55\include\stdio.h) test.c 75 error [Warning 533] function 'inputdata(void)' should return a value (see line 50) test.c 78 error [Info 745] function 'showdata()' has no explicit type or class, int assumed test.c 78 error [Warning 532] Return mode of function 'showdata(void)' inconsistent with line 40 test.c 86 error [Warning 560] argument no. 2 should be a pointer test.c 91 error [Warning 533] function 'showdata(void)' should return a value (see line 77) test.c 91 error [Warning 529] Symbol 'limit' (line 79) not subsequently referenced test.c 93 error [Info 745] function 'sort_asc_by_age' has no explicit type or class, int assumed test.c 98 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 98] test.c 100 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 100] test.c 101 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 101] test.c 102 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 102 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 102] test.c 103 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 103 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 103] test.c 104 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 104] test.c 105 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 105] test.c 106 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 106 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 106] test.c 107 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 107 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 97, 107] test.c 109 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 111 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 116 error [Warning 560] argument no. 2 should be a pointer test.c 121 error [Warning 533] function 'sort_asc_by_age(void)' should return a value (see line 92) test.c 123 error [Info 745] function 'sort_asc_by_year' has no explicit type or class, int assumed test.c 131 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 132 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 135 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 136 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 138 error [Error 64] Type mismatch (assignment) (char [20] = int) test.c 139 error [Error 64] Type mismatch (assignment) (int = pointer) test.c 140 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 145 error [Warning 560] argument no. 2 should be a pointer test.c 150 error [Warning 533] function 'sort_asc_by_year(void)' should return a value (see line 122) test.c 152 error [Info 745] function 'sort__desc_by_age' has no explicit type or class, int assumed test.c 157 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 157] test.c 159 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 159] test.c 160 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 160] test.c 161 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 161 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 161] test.c 162 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 162 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 162] test.c 163 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 163] test.c 164 error [Warning 661] Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 164] test.c 165 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 165 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 165] test.c 166 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 166 error [Warning 662] Possible creation of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file test.c: lines 156, 166] test.c 168 error [Error 64] Type mismatch (assignment) (char [20] = int) test.c 169 error [Error 64] Type mismatch (assignment) (int = pointer) test.c 170 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 175 error [Warning 560] argument no. 2 should be a pointer test.c 180 error [Warning 533] function 'sort__desc_by_age(void)' should return a value (see line 151) test.c 182 error [Info 745] function 'sort_desc_by_year' has no explicit type or class, int assumed test.c 191 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 192 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 195 error [Error 64] Type mismatch (assignment) (char [20] = char *) test.c 196 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 198 error [Error 64] Type mismatch (assignment) (char [20] = int) test.c 199 error [Error 64] Type mismatch (assignment) (int = pointer) test.c 200 error [Error 64] Type mismatch (assignment) (char [6] = char *) test.c 205 error [Warning 560] argument no. 2 should be a pointer test.c 210 error [Info 783] Line does not end with new-line test.c 210 error [Warning 533] function 'sort_desc_by_year(void)' should return a value (see line 181) test.c 211 error [Info 766] Header file 'c:\progra~1\borland\bcc55\include\string.h' not used in module 'test.c' --- Global Wrap-up test.c 45 error [Warning 526] Symbol 'getch()' (line 45, file test.c) not defined test.c 45 error [Warning 628] no argument information provided for function 'getch()' (line 45, file test.c) test.c 25 error [Warning 526] Symbol 'clrscr()' (line 25, file test.c) not defined test.c 25 error [Warning 628] no argument information provided for function 'clrscr()' (line 25, file test.c) test.c 151 error [Info 714] Symbol 'sort__desc_by_age(void)' (line 151, file test.c) not referenced test.c 92 error [Info 714] Symbol 'sort_asc_by_age(void)' (line 92, file test.c) not referenced test.c 122 error [Info 714] Symbol 'sort_asc_by_year(void)' (line 122, file test.c) not referenced test.c 181 error [Info 714] Symbol 'sort_desc_by_year(void)' (line 181, file test.c) not referenced
it shows and error of Lvalue required... i don't know how to fix it...
strcpy to copy strings. #include <stdio.h>
#include <string.h>
#define size 20
struct data
{
int age;
int year;
char course[6];
char name[20];
} students[20];
struct temporary //changed to struct?
{
int age;
int year;
char course[6];
char name[20];
} holder;
int main()
{
int x,limit;
int input;
do
{
//clrscr(); non portable avoid if possible
puts("1..insert data");
puts("2..show data");
puts("3..show data in ascending order by age");
puts("4..show data in ascending order by year");
puts("5..show data in descending order by age");
puts("6..show data in descending order by year");
puts("9..exit");
printf("input choice:"); scanf("%d",&input);
switch(input)
{
case 1:
inputdata();
break;
case 2:
showdata();
break;
case 3:
sort_asc_by_age(); //added this case
break; //added this case
}
}while(input!=9);
getchar(); //getchar better than getch()
//getch is non-portable
return 0;
}
inputdata()
{
int limit,x;
printf("Size of structure to make? (1-20)\t");
scanf("%d",&limit);
if(limit<1 || limit>size)
{
printf("Input Invalid!");
}
else
{
limit=limit-1;
printf("\n\n\nAge Year Course Name\n");
for(x=0; x<=limit; x++)
{
printf("Age:");
scanf("%d",&students[x].age);
printf("Year:");
scanf("%d",&students[x].year);
printf("Course:");
scanf("%s",students[x].course); //gets = bad
printf("Name:");
scanf("%s",students[x].name); //gets = bad
//although scanf is a lesser evil
//for better a better input tutorial in c
//check out dave's tutorial
printf("\nNext entry\n");
}
}
}
showdata()
{
int limit;
int x;
printf("This are the items you inputted!");
printf("\nAge Year level Course Name\n");
for(x=0;x<size;x++)
{
printf("%d",students[x].age);
printf("\t%d",students[x].year);//changed to %d (it is an integer!)
printf("\t%s",students[x].course);
printf("\t%s\n",students[x].name);
}
getchar(); //getchar better than getch()
}
sort_asc_by_age()
{
int x,y;
for(x = 0; x < size; x++)
for(y = 0; y < size; y++)
if(students[y].age > students[y+1].age)
{
holder.age=students[y+1].age;
holder.year=students[y+1].year;
strcpy(holder.course,students[y+1].course); //changed string copy
strcpy(holder.name,students[y+1].name);// changed
students[y+1].age=students[y].age;
students[y+1].year=students[y].year;
strcpy(students[y+1].name,students[y].name);//changed
strcpy(students[y+1].course,students[y].course);//changed
students[y].age=holder.age;
students[y].year=holder.year;
strcpy(students[y].name,holder.name); //changed
strcpy(students[y].course,holder.course);//changed
}
for(x=0;x<size;x++)
{
printf("%d",students[x].age);
printf("\t%d",students[x].year); //%d
printf("\t%s",students[x].course);
printf("\t%s\n",students[x].name);
}
getch();
}
sort_asc_by_year()
{
int x,y;
for(x = 0; x < size; x++)
for(y = 0; y < size-1; y++)
if(students[y].year > students[y+1].age)
{
holder.age=students[y+1].age;
holder.year=students[y+1].year;
strcpy(holder.course,students[y+1].course); //changed
strcpy(holder.name,students[y+1].name);//changed
students[y+1].age=students[y].age;
students[y+1].year=students[y].year;
strcpy(students[y+1].name,students[y].name);//changed
strcpy(students[y+1].course,students[y].course);//changed
students[y].age=holder.age;
students[y].year=holder.year;
strcpy(students[y].name,holder.name); //changed
strcpy(students[y].course,holder.course);//changed
}
for(x=0;x<size;x++)
{
printf("%d",students[x].age);
printf("\t%d",students[x].year); //%d
printf("\t%s",students[x].course);
printf("\t%s\n",students[x].name);
}
getchar(); //getchar
}
sort__desc_by_age()
{
int x,y;
for(x = 0; x < size; x++)
for(y = 0; y < size; y++)
if(students[y].age < students[y+1].age)
{
holder.age=students[y+1].age;
holder.year=students[y+1].year;
strcpy(holder.course,students[y+1].course); //changed
strcpy(holder.name,students[y+1].name);//changed
students[y+1].age=students[y].age;
students[y+1].year=students[y].year;
strcpy(students[y+1].name,students[y].name);//changed
strcpy(students[y+1].course,students[y].course);//changed
students[y].age=holder.age;
students[y].year=holder.year;
strcpy(students[y].name,holder.name); //changed
strcpy(students[y].course,holder.course);//changed
}
for(x=0;x<size;x++)
{
printf("%d",students[x].age);
printf("\t%d",students[x].year); //%d
printf("\t%s",students[x].course);
printf("\t%s\n",students[x].name);
}
getch();
}
sort_desc_by_year()
{
int x,y;
for(x = 0; x < size; x++)
for(y = 0; y < size-1; y++)
if(students[y].year < students[y+1].age)
{
holder.age=students[y+1].age;
holder.year=students[y+1].year;
strcpy(holder.course,students[y+1].course); //changed
strcpy(holder.name,students[y+1].name);//changed
students[y+1].age=students[y].age;
students[y+1].year=students[y].year;
strcpy(students[y+1].name,students[y].name);//changed
strcpy(students[y+1].course,students[y].course);//changed
students[y].age=holder.age;
students[y].year=holder.year;
strcpy(students[y].name,holder.name); //changed
strcpy(students[y].course,holder.course);//changed
}
for(x=0;x<size;x++)
{
printf("%d",students[x].age);
printf("\t%d",students[x].year); //%d
printf("\t%s",students[x].course);
printf("\t%s\n",students[x].name);
}
getchar(); //getchar()
}
#include <stdio.h> #include <string.h> #include <conio.h> #define size 20 struct data{ int age; int year; char course[6]; char name[20]; } students[20]; struct temporary{ int age; int year; char course[6]; char name[20]; } holder; int main() { int x,limit; int input; clrscr(); do { printf("this will not appear!"); clrscr(); puts("1..insert data"); puts("2..show data in ascending order by age"); puts("3..show data in ascending order by year"); puts("4..show data in descending order by age"); puts("5..show data in descending order by year"); puts("6..exit"); printf("input choice:"); scanf("%d",&input); switch(input) { case 1: inputdata(input); break; case 2: sort_asc_by_age(input); break; case 3: sort_asc_by_year(input); break; case 4: sort_desc_by_age(input); break; case 5: sort_desc_by_year(input); break; } }while(input!=6); printf("Jeffrey polpol!"); getchar(); return 0; } inputdata(int input) { int limit,x,a,b,c; clrscr(); printf("Size of data to make? (1-20):\t"); scanf("%d",&limit); input=limit; if(limit<1 || limit>size) { printf("Input Invalid!"); } else { clrscr(); limit=limit-1; gotoxy(1,1); printf("Age Year Course Name"); b=2; for(x=0; x<=limit; x++) { c=1; a=c; flushall(); gotoxy(a,b); scanf("%d",&students[x].age); a=c+6; c=a; clreol(); gotoxy(a,b); scanf("%d",&students[x].year); a=c+8; c=a; clreol(); gotoxy(a,b); scanf("%s",students[x].course); a=c+12; c=a; clreol(); gotoxy(a,b); scanf("%s",students[x].name); b++; clreol(); gotoxy(a,b); printf("\n Next entry \n"); clreol(); } } return input; printf("press any key to show menu"); } sort_asc_by_age(int input) { int x,y,limit=input; clrscr(); for(x = 0; x <limit; x++) for(y = 0; y <limit-1; y++) if(students[y].age > students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; strcpy(holder.course,students[y+1].course); strcpy(holder.name,students[y+1].name); students[y+1].age=students[y].age; students[y+1].year=students[y].year; strcpy(students[y+1].name,students[y].name); strcpy(students[y+1].course,students[y].course); students[y].age=holder.age; students[y].year=holder.year; strcpy(students[y].name,holder.name); strcpy(students[y].course,holder.course); } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%d",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } printf("press any key to show menu"); printf("ayay.."); getch(); } sort_asc_by_year(int input) { int x,y,limit=input; clrscr(); for(x=0;x<limit; x++) for(y=0;y<limit-1;y++) if(students[y].year>students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; strcpy(holder.course,students[y+1].course); strcpy(holder.name,students[y+1].name); students[y+1].age=students[y].age; students[y+1].year=students[y].year; strcpy(students[y+1].name,students[y].name); strcpy(students[y+1].course,students[y].course); students[y].age=holder.age; students[y].year=holder.year; strcpy(students[y].name,holder.name); strcpy(students[y].course,holder.course); } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%d",students[x].year); /*%d*/ printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } printf("press any to key to menu"); printf("hikap samad"); getch(); } sort_desc_by_age(int input) { int x,y,limit=input; clrscr(); for(x = 0; x < limit; x++) for(y = 0; y < limit-1; y++) if(students[y].age < students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; strcpy(holder.course,students[y+1].course); strcpy(holder.name,students[y+1].name); students[y+1].age=students[y].age; students[y+1].year=students[y].year; strcpy(students[y+1].name,students[y].name); strcpy(students[y+1].course,students[y].course); students[y].age=holder.age; students[y].year=holder.year; strcpy(students[y].name,holder.name); strcpy(students[y].course,holder.course); } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%d",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } printf("press any key to show menu"); printf("jeffrey asa"); getch(); } sort_desc_by_year(int input) { int x,y,limit=input; clrscr(); for(x = 0; x < limit; x++) for(y = 0; y < limit-1; y++) if(students[y].year < students[y+1].age) { holder.age=students[y+1].age; holder.year=students[y+1].year; strcpy(holder.course,students[y+1].course); strcpy(holder.name,students[y+1].name); students[y+1].age=students[y].age; students[y+1].year=students[y].year; strcpy(students[y+1].name,students[y].name); strcpy(students[y+1].course,students[y].course); students[y].age=holder.age; students[y].year=holder.year; strcpy(students[y].name,holder.name); strcpy(students[y].course,holder.course); } for(x=0;x<size;x++) { printf("%d",students[x].age); printf("\t%d",students[x].year); printf("\t%s",students[x].course); printf("\t%s\n",students[x].name); } printf("press any key to show menu"); printf("polpol jeffrey"); getch(); }
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006
--- Module: test.c (C)
test.c 36 error [Info 718] Symbol 'inputdata' undeclared, assumed to return int
test.c 36 error [Info 746] call to function 'inputdata()' not made in the presence of a prototype
test.c 38 error [Info 718] Symbol 'sort_asc_by_age' undeclared, assumed to return int
test.c 38 error [Info 746] call to function 'sort_asc_by_age()' not made in the presence of a prototype
test.c 40 error [Info 718] Symbol 'sort_asc_by_year' undeclared, assumed to return int
test.c 40 error [Info 746] call to function 'sort_asc_by_year()' not made in the presence of a prototype
test.c 41 error [Info 725] Expected positive indentation from line 34
test.c 43 error [Info 718] Symbol 'sort_desc_by_age' undeclared, assumed to return int
test.c 43 error [Info 746] call to function 'sort_desc_by_age()' not made in the presence of a prototype
test.c 44 error [Info 725] Expected positive indentation from line 34
test.c 45 error [Info 718] Symbol 'sort_desc_by_year' undeclared, assumed to return int
test.c 45 error [Info 746] call to function 'sort_desc_by_year()' not made in the presence of a prototype
test.c 46 error [Info 725] Expected positive indentation from line 34
test.c 48 error [Info 744] switch statement has no default
test.c 51 error [Warning 534] Ignoring return value of function '_fgetc(FILE *)' (compare with line 294, file c:\progra~1\borland\bcc55\include\stdio.h)
test.c 53 error [Warning 529] Symbol 'x' (line 20) not subsequently referenced
test.c 53 error [Warning 529] Symbol 'limit' (line 20) not subsequently referenced
test.c 56 error [Info 745] function 'inputdata()' has no explicit type or class, int assumed
test.c 56 error [Warning 532] Return mode of function 'inputdata(int)' inconsistent with line 36
test.c 75 error [Warning 525] Negative indentation from line 73
test.c 76 error [Warning 525] Negative indentation from line 73
test.c 77 error [Warning 525] Negative indentation from line 73
test.c 77 error [Warning 534] Ignoring return value of function 'flushall(void)' (compare with line 299, file c:\progra~1\borland\bcc55\include\stdio.h)
test.c 79 error [Warning 525] Negative indentation from line 73
test.c 80 error [Warning 525] Negative indentation from line 73
test.c 81 error [Warning 525] Negative indentation from line 73
test.c 83 error [Warning 525] Negative indentation from line 73
test.c 84 error [Warning 525] Negative indentation from line 73
test.c 85 error [Warning 525] Negative indentation from line 73
test.c 87 error [Warning 525] Negative indentation from line 73
test.c 88 error [Warning 525] Negative indentation from line 73
test.c 89 error [Warning 525] Negative indentation from line 73
test.c 91 error [Warning 525] Negative indentation from line 73
test.c 92 error [Warning 525] Negative indentation from line 73
test.c 95 error [Warning 525] Negative indentation from line 73
test.c 98 error [Warning 527] Unreachable code at token 'printf'
test.c 99 error [Warning 533] function 'inputdata(int)' should return a value (see line 55)
test.c 102 error [Info 745] function 'sort_asc_by_age()' has no explicit type or class, int assumed
test.c 102 error [Warning 532] Return mode of function 'sort_asc_by_age(int)' inconsistent with line 38
test.c 109 error [Warning 525] Negative indentation from line 107
test.c 110 error [Warning 525] Negative indentation from line 107
test.c 111 error [Warning 525] Negative indentation from line 107
test.c 112 error [Warning 525] Negative indentation from line 107
test.c 113 error [Warning 525] Negative indentation from line 107
test.c 114 error [Warning 525] Negative indentation from line 107
test.c 115 error [Warning 525] Negative indentation from line 107
test.c 116 error [Warning 525] Negative indentation from line 107
test.c 117 error [Warning 525] Negative indentation from line 107
test.c 118 error [Warning 525] Negative indentation from line 107
test.c 119 error [Warning 525] Negative indentation from line 107
test.c 120 error [Warning 525] Negative indentation from line 107
test.c 122 error [Warning 539] Did not expect positive indentation from line 105
test.c 124 error [Info 725] Expected positive indentation from line 122
test.c 125 error [Info 725] Expected positive indentation from line 122
test.c 126 error [Info 725] Expected positive indentation from line 122
test.c 127 error [Info 725] Expected positive indentation from line 122
test.c 131 error [Warning 534] Ignoring return value of function 'getch(void)' (compare with line 174, file c:\progra~1\borland\bcc55\include\conio.h)
test.c 132 error [Warning 533] function 'sort_asc_by_age(int)' should return a value (see line 101)
test.c 135 error [Info 745] function 'sort_asc_by_year()' has no explicit type or class, int assumed
test.c 135 error [Warning 532] Return mode of function 'sort_asc_by_year(int)' inconsistent with line 40
test.c 141 error [Warning 525] Negative indentation from line 140
test.c 142 error [Warning 525] Negative indentation from line 140
test.c 143 error [Warning 525] Negative indentation from line 140
test.c 144 error [Warning 525] Negative indentation from line 140
test.c 145 error [Warning 525] Negative indentation from line 140
test.c 146 error [Warning 525] Negative indentation from line 140
test.c 147 error [Warning 525] Negative indentation from line 140
test.c 148 error [Warning 525] Negative indentation from line 140
test.c 149 error [Warning 525] Negative indentation from line 140
test.c 150 error [Warning 525] Negative indentation from line 140
test.c 151 error [Warning 525] Negative indentation from line 140
test.c 152 error [Warning 525] Negative indentation from line 140
test.c 153 error [Warning 525] Negative indentation from line 140
test.c 154 error [Warning 525] Negative indentation from line 140
test.c 162 error [Warning 539] Did not expect positive indentation from line 155
test.c 164 error [Warning 534] Ignoring return value of function 'getch(void)' (compare with line 174, file c:\progra~1\borland\bcc55\include\conio.h)
test.c 165 error [Warning 533] function 'sort_asc_by_year(int)' should return a value (see line 134)
test.c 168 error [Info 745] function 'sort_desc_by_age()' has no explicit type or class, int assumed
test.c 168 error [Warning 532] Return mode of function 'sort_desc_by_age(int)' inconsistent with line 43
test.c 175 error [Warning 525] Negative indentation from line 173
test.c 176 error [Warning 525] Negative indentation from line 173
test.c 177 error [Warning 525] Negative indentation from line 173
test.c 178 error [Warning 525] Negative indentation from line 173
test.c 179 error [Warning 525] Negative indentation from line 173
test.c 180 error [Warning 525] Negative indentation from line 173
test.c 181 error [Warning 525] Negative indentation from line 173
test.c 182 error [Warning 525] Negative indentation from line 173
test.c 183 error [Warning 525] Negative indentation from line 173
test.c 184 error [Warning 525] Negative indentation from line 173
test.c 185 error [Warning 525] Negative indentation from line 173
test.c 186 error [Warning 525] Negative indentation from line 173
test.c 195 error [Warning 539] Did not expect positive indentation from line 188
test.c 197 error [Warning 534] Ignoring return value of function 'getch(void)' (compare with line 174, file c:\progra~1\borland\bcc55\include\conio.h)
test.c 198 error [Warning 533] function 'sort_desc_by_age(int)' should return a value (see line 167)
test.c 201 error [Info 745] function 'sort_desc_by_year()' has no explicit type or class, int assumed
test.c 201 error [Warning 532] Return mode of function 'sort_desc_by_year(int)' inconsistent with line 45
test.c 207 error [Warning 525] Negative indentation from line 206
test.c 209 error [Warning 525] Negative indentation from line 206
test.c 210 error [Warning 525] Negative indentation from line 206
test.c 211 error [Warning 525] Negative indentation from line 206
test.c 212 error [Warning 525] Negative indentation from line 206
test.c 213 error [Warning 525] Negative indentation from line 206
test.c 214 error [Warning 525] Negative indentation from line 206
test.c 215 error [Warning 525] Negative indentation from line 206
test.c 216 error [Warning 525] Negative indentation from line 206
test.c 217 error [Warning 525] Negative indentation from line 206
test.c 218 error [Warning 525] Negative indentation from line 206
test.c 219 error [Warning 525] Negative indentation from line 206
test.c 220 error [Warning 525] Negative indentation from line 206
test.c 228 error [Warning 539] Did not expect positive indentation from line 221
test.c 230 error [Warning 534] Ignoring return value of function 'getch(void)' (compare with line 174, file c:\progra~1\borland\bcc55\include\conio.h)
test.c 231 error [Warning 533] function 'sort_desc_by_year(int)' should return a value (see line 200)
Outputting to file test.lob
c:\progra~1\borland\bcc55\bin\bcc32 -P- -c @MAKE0000.@@@
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.c:
Warning W8065 test.c 36: Call to function 'inputdata' with no prototype in function main
Warning W8065 test.c 38: Call to function 'sort_asc_by_age' with no prototype in function main
Warning W8065 test.c 40: Call to function 'sort_asc_by_year' with no prototype in function main
Warning W8065 test.c 43: Call to function 'sort_desc_by_age' with no prototype in function main
Warning W8065 test.c 45: Call to function 'sort_desc_by_year' with no prototype in function main
Warning W8080 test.c 53: 'limit' is declared but never used in function main
Warning W8080 test.c 53: 'x' is declared but never used in function main
Warning W8066 test.c 98: Unreachable code in function inputdata
Warning W8070 test.c 99: Function should return a value in function inputdata
Warning W8004 test.c 88: 'c' is assigned a value that is never used in function inputdata
Warning W8070 test.c 132: Function should return a value in function sort_asc_by_age
Warning W8070 test.c 165: Function should return a value in function sort_asc_by_year
Warning W8070 test.c 198: Function should return a value in function sort_desc_by_age
Warning W8070 test.c 231: Function should return a value in function sort_desc_by_year
| DaniWeb Message | |
| Cancel Changes | |