Define Direktifi
C Define Direktifi ayrıntılı incelendi. Switch-case yapısında define direktiflerinin kullanımı.
#ifndef DEFINE_H_
#define DEFINE_H_
#define LOOP_COUNT 1000
#define ARRAY_SIZE 10
#define MAX 500
#define MIN (MAX-400)
#define BOOL int
#define TRUE 1
#define FALSE 0
#define VALID 1
#define UNVALID 0
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define FILE_NOT_OPEN "can not open file\n"
#define BYTE char
#define INT32 int
#define INT16 short
#define M_PI 3.15
#endif /* DEFINE_H_ */
#ifndef DEFINE_H_
#define DEFINE_H_
#define LOOP_COUNT 1000
#define ARRAY_SIZE 10
#define MAX 500
#define MIN (MAX-400)
#define BOOL int
#define TRUE 1
#define FALSE 0
#define VALID 1
#define UNVALID 0
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define FILE_NOT_OPEN "can not open file\n"
#define BYTE char
#define INT32 int
#define INT16 short
#define M_PI 3.15
#endif /* DEFINE_H_ */
#include <stdio.h>
#include <stdlib.h>
#include "define.h"
#define SIZE 100
char str[ARRAY_SIZE];
int array[SIZE]; // array[=100]
BOOL isNumber()
{
BOOL retValue = FALSE;
INT32 a;
}
int main(void) {
//ayni uzunlukta dongu birden fazla
{
int i = 0;
for(i=0; i < LOOP_COUNT; ++i)
{
printf("%d\n", i);
}
}
printf(FILE_NOT_OPEN);
return EXIT_SUCCESS;
}
Hiç yorum yok:
Yorum Gönder