Expected primary expression before char
I also want to sort the characters in alphabetical order, but i don't know how.
#include <stdio.h>
#include <string.h>
void introduction(){
printf("\nWelcome!\n");
}
void caps(char name1,char name2,char name3,char name4,char name5){
}
main(){
char name1[20], name2[20], name3[20], name4[20], name5[20];
int qty[5];
introduction();
printf("Input 5 stock names:\n");
gets(name1);
gets(name2);
gets(name3);
gets(name4);
gets(name5);
caps(char name1,char name2,char name3,char name4,char name5);
printf("Input quantity of each item:\n%s ------- ", name1);
scanf("%d", &qty[0]);
printf("%s ------- ", name2);
scanf("%d", &qty[1]);
printf("%s ------- ", name3);
scanf("%d", &qty[2]);
printf("%s ------- ", name4);
scanf("%d", &qty[3]);
printf("%s ------- ", name5);
scanf("%d", &qty[4]);
}
This is C code. Are you deliberately coding in C, or would you switch to C++? This is much, much easier with proper C++ strings and io.
the application i'm using currently is c++. #include <stdio.h>
#include <string.h> are the only Preprocessor directives i know.