0

i have been trying to compile for a while now worked fine until i added a symbolic constant then i get all kinds of syntax errors please help thanks
heres source code:

#include <stdio.h>
#include <stdlib.h>
//GIGO.c- Coded by Ross Camarillo aka Bubonic_88
// on 12/02/2009 
//Created by Randy Gibson
#define SYMB '*' // character to show in the letters



	void letter_G (char SM);	
	void letter_I (char SM);
	void letter_O (Char SM);
    void displayline (void);
   
        int main (void)
{	
	letter_G(SYMB);
	displayline();
	letter_I(SYMB);
	displayline();
	letter_G(SYMB);
	displayline();
	letter_O(SYMB);
	getchar(); // to cause system pause
	return(0);
	}

// child functions

void displayline (void) // display the line break in the main function
{
printf("-----\n");
}
void letter_G (char SM)  
 //display ther letter g
{
	printf(" %c%c%c \n",SM,SM,SM);
	printf("%c   \n"),SM;
    printf("%c %c%c%c\n",SM,SM,SM,SM);
    printf("%c   %c\n"),SM,SM;
	printf(" %c%c%c \n"),SM,SM,SM);
}   
void letter_I (char SM)
 // display the letter i
{
	printf("%c%c%c%c%c\n"),SM,SM,SM,SM,SM);
	printf("  %c  \n"),SM);
	printf("  %c  \n",SM);
	printf("  %c \n",SM);
	printf("%c%c%c%c%c\n",SM,SM,SM,SM,SM);	
}
void letter_O(char SM)
{
	printf(" %c%c%c \n",SM,SM,SM);
	printf("%c   %c\n",SM,SM);
	printf("%c   %c\n",SM,SM);
	printf("%C   %c\n",SM,SM);
	printf(" %c%c%c \n"),SM,SM,SM;
	}

Edited by Nick Evan: Added code-tags

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by xavier666
0

Line 12: Char should be char
Line 38: ) in the wrong place
Line 40: ) in the wrong place
Line 41: Extra )
Line 47: Extra )
Line 58: ) in the wrong place

There may be others.
When you compile please try to look over the lines which generate the errors as you can often see what went wrong.

Edited by jonsca: n/a

1

The errors were :-

  • Writing %C instead of %c
  • Placing the brackets incorrectly

The corrected code is as follows:-

#include <stdio.h>
#include <stdlib.h>
//GIGO.c- Coded by Ross Camarillo aka Bubonic_88
// on 12/02/2009
//Created by Randy Gibson
#define SYMB '*' // character to show in the letters



void letter_G (char SM);
void letter_I (char SM);
void letter_O (char SM);
void displayline (void);

int main (void)
{
	letter_G(SYMB);
	displayline();
	letter_I(SYMB);
	displayline();
	letter_G(SYMB);
	displayline();
	letter_O(SYMB);
	getchar(); // to cause system pause
	return(0);
}

// child functions

void displayline (void) // display the line break in the main function
{
	printf("-----\n");
}
void letter_G (char SM)
 //display ther letter g
{
	printf(" %c%c%c \n",SM,SM,SM);
	printf("%c   \n",SM);
	printf("%c %c%c%c\n",SM,SM,SM,SM);
	printf("%c   %c\n",SM,SM);
	printf(" %c%c%c \n",SM,SM,SM);
}
void letter_I (char SM)
 // display the letter i
{
	printf("%c%c%c%c%c\n",SM,SM,SM,SM,SM);
	printf("  %c  \n",SM);
	printf("  %c  \n",SM);
	printf("  %c \n",SM);
	printf("%c%c%c%c%c\n",SM,SM,SM,SM,SM);
}
void letter_O(char SM)
{
	printf(" %c%c%c \n",SM,SM,SM);
	printf("%c   %c\n",SM,SM);
	printf("%c   %c\n",SM,SM);
	printf("%c   %c\n",SM,SM);
	printf(" %c%c%c \n",SM,SM,SM);
}

A better program would be writing it in a single line

Edited by xavier666: forgot to give /icode

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.