>Maybe I do not understnad that when yuou pass array you must accept as pointer.
Arrays decay into pointers to the first element in all but three cases: As the operand of sizeof, as the operand of the address-of operator and as a string literal initializer for an array of char. For any other use you should recognize that you end up working with a pointer to the first element instead of the array as a whole, and that includes passing arrays as a function parameter.
Code:
#ifndef DECLARE_H
#define DECLARE_H
//Function prototypes
void print_menu();
//Global Variables
char filename[100];
int rc;
#endif;
Header guards, good. Global variables, bad. If you must use them then the preferred way to go about it is to have a single .c file for the definitions and use the header for declarations:
declare.h
Code:
#ifndef DECLARE_H
#define DECLARE_H
//Function prototypes
void print_menu(void);
int create_log_file(void); /* No need for an argument, filename is global */
//Global Variables
extern char filename[];
extern int rc;
#endif
declare.c
Code:
#include "declare.h"
char filename[100];
int rc;
main.c
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "declare.h"
#include "employee_data.h"
int main()
{
int choice;
rc=create_log_file();
return 0;
}
printdata.c
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "declare.h"
#include "employee_data.h"
/****************************************
create_log_file() - create new log file
Return: 0 - Success
1 - Error
****************************************/
int create_log_file(void)
{
}