I have a very simple program that is expected to take X characters less from the user and return them back:
#include <stdio.h>
#define MAX_INPUT_LENGTH 8
#define HOME 1
int main()
{
char vstup[MAX_INPUT_LENGTH];
printf("Write something. But no more than "MAX_INPUT_LENGTH" characters.\n");
scanf("%"MAX_INPUT_LENGTH"s", vstup);
printf(vstup);
system("pause");
return 0;
}
Of course, my attempt with "blah"CONSTANT"blah"does not work. But this should not be, right? I thought that the constant is basically just replaced by fragments of text in the program, and only with some basic logic.
source
share