bat/tests/syntax-tests/highlighted/C/test.c
2020-10-05 09:06:47 +02:00

63 lines
7.2 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
void test_function()
{
#define TEST
#ifdef TEST
 printf("TEST is defined\n");
#endif
}
struct Node
{
 int val;
 struct Node *next;
};
int main(int argc, char **argv)
{
 /* This C program was written to help bat
 * with its syntax highlighting tests
 */
 // Calling test function
 test_function();
 struct Node *head = NULL;
 head = (struct Node *)malloc(sizeof(struct Node *));
 head->val = -1;
 if (head->val == 1 * -1)
 {
 head->val = 10;
 }
 else
 {
 head->val = argc;
 }
 int t = head->val, count = 0;
 free(head);
 while (t--)
 {
 count++;
 }
 for (int i = t; i < count; ++i)
 {
 do
 {
 --count;
 } while (false);
 }
 enum chars
 {
 M,
 I,
 T,
 H,
 L
 };
 char *string = "string";
 printf("true is #define true %d\n", true);
 return 0;
}