Thread: again same program different problem.

  1. #1
    Registered User arti's Avatar
    Join Date
    May 2010
    108 again same program different problem.

    I'm writing a program that will take three test scores of a student whose name has been inputted by the user and that number will be divided by 3, finding the average.

    My problem isn't working, well when I gcc my proyect I get a lot of warnings. May someone revise my code please. Thank you so much I appreciate your help.


    #define addr(var) &var
    #define REPORTHEADING1 "Student T1 T2 T3 Avg\n"
    #define REPORTHEADING2 "======= == == == ===\n"
    #define REPORTFORMAT "%-10s%3d%7d%7d%8.2f\n"
    #define BLANK2LINES "\n\n"

    void InputStudentInfo(char *fn, char *ln, char fullName);

    int main (void)
     char lastname[15+1], 
     char combinedName[27+1];
     int t1,t2, t3;
     float avg;
     InputStudentInfo(lastname, firstname, combinedName);
     printf("Enter the student's three(3) test scores seperate with space ");
     scanf("%d%d%d", addr(t1),addr(t2),addr(t3));
     printf(REPORTHEADING1), printf(REPORTHEADING2);
     printf(REPORTFORMAT, combinedName, t1, t1, t3, avg);
     return 0;
    void InputStudentInfor(char *fn, char *ln, char fullName)
     char comma=',';
     printf("Enter the student's first name");
     scanf("%s", fn);
     printf("Enter the student's last name");
     scanf("%s", ln);
     strcat(fullName, fn); 
    Last edited by arti; 05-04-2010 at 01:05 AM. Reason: I reiterate I'm knew at this...C programming is hard for me.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Why on earth did you make a macro to get an address? If you are getting a lot of warnings, as you put it, why don't you start fixing them? strcat expects two string arguments, not an argument and a character. (comma)

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multi Thread Program Problem
    By ZNez in forum C Programming
    Replies: 1
    Last Post: 01-03-2009, 11:10 AM
  2. Program Termination Problem
    By dacbo in forum C Programming
    Replies: 3
    Last Post: 01-23-2006, 02:34 AM
  3. Inheritance and Dynamic Memory Program Problem
    By goron350 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2005, 02:38 PM
  4. Replies: 20
    Last Post: 06-12-2005, 11:53 PM