c++ - Error: Cannot convert argument 1 from 'char [80]' to 'char' -


i'm trying pass int struct. have validate , class instructions have run through function.

here's error message:

c2664: 'int get_id(char)' : cannot convert argument 1 'char [80]' 'char'

 #define _crt_secure_no_warnings     #include <stdio.h>     #include <conio.h>     #include <stdlib.h>     #include <cstdio>     #include <iostream>     #include <fstream>     #include <cstring>     #include <exception>   //functions called int get_id(char);  //structs struct fileinfo {     int id;     char name[20];     char state[5];     char dis_code;     float balance;     char due_date[40]; };   //why void? int main(void) {     fileinfo info[80];      int ct = 0;     char more = 'y';     char buff[80];      while (more == 'y')     {          printf("id: ");         gets_s(buff);          info[ct].id = get_id(buff);         printf("this id: %i", info[ct].id);          printf("do want enter another? ");         gets_s(buff);         more = buff[0];     }      system("pause");  }//end main  int get_id(char buf[]) {     int id;     char buffer[85];     bool check = false;      id = atoi(buf);     while (check == false)     {         if (id > 998)         {             printf("\n id number large, please re-enter: ");             gets_s(buffer);             id = atoi(buffer);             check = false;         }         else         {             check = true;         }     }      return id; } 


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -