Errors with '{' ';' ')' signs

so I am trying to write a code to print to screen a diagonal line using MACROs
and keep getting errors with the signs listed above. can anyone help figure out what is wrong?


#include <stdio.h>
#include<stdlib.h>

#define LEADER_CHAR 46
#define DIAGONAL_CHAR 37
#define MAX_ROWS
#define MAX_COLS (MAX_ROWS)

int main(void)
{
int rows;
int row;
int column;
int count = 0;
int i;

printf("Enter the number of rows\n");
scanf("%d", &rows);

printf("Leading character is%c\n", LEADER_CHAR);
printf("Diagonal character is %c\n", DIAGONAL_CHAR);

printf("\n%c", DIAGONAL_CHAR, '\n');

for (row = 0; row < MAX_ROWS; ++row)
{
count++;

for (i = 1; i <= count; i++) printf("\n%c", LEADER_CHAR);

for (column = 0; column < MAX_COLS; ++column)
{
printf("%c", DIAGONAL_CHAR);
}
printf("\n%c", LEADER_CHAR);
}

return 0;
}
You forgot to actually define MAX_ROWS and MAX_COLS
Thanks that worked but my first printf and scanf keeps showing errors. Can you tell whats wrong?
my error is:
Severity Code Description Project File Line Suppression State
Error C4996 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. e2macro c:\users\owner\documents\visual studio 2015\projects\e2macros\e1a2e2_kb.cpp 20
Last edited on
The error is a good one, use the scanf_s function like it says :+)

scanf functions returns a value, you should make use of that to see that it worked. A switch is handy for taking care of the result, when there are multiple variables to be scanned.

http://en.cppreference.com/w/c/io/fscanf


Rather than #define , use const variables instead. This answer verifies what I am saying, see the answer by nbt

http://stackoverflow.com/questions/6004963/why-use-define-instead-of-a-variable


In the future could we ask you to ensure that code tags are used? I know the button on the create a new topic don't always work, but you can go back afterwards and put them in:

http://www.cplusplus.com/articles/z13hAqkS/
Topic archived. No new replies allowed.