Like Tree2Likes
  • 1 Post By Malcolm McLean
  • 1 Post By Salem

Defines, Macros and Header files

This is a discussion on Defines, Macros and Header files within the C Programming forums, part of the General Programming Boards category; Modify program by saving the function, the define and the macro you wrote in a header file. Run the program ...

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    31

    Defines, Macros and Header files

    Modify program by saving the function, the define and the macro you wrote in a header file. Run the program using the same or similar main function.

    Code:
     
    Code:
    #include<stdio.h>
    #include<conio.h>
    #define name   "Alex Willimson"
    #define address "40 tuxedo court"
    #define student "324-787-647"
    #define prggrade "78.82"
    #define prgmark "B+"
    void fun (void);
    main()
    {
    	fun();
    	getch();
    }
    
    
    void fun(void)
    {
    	printf("NAME: %s",name);
    	printf("\n\nADDRESS: %s", address);
    	printf("\n\nSTUDENTNUMBER: %s" , student);
    	printf("\n\nPRG155 Grade %%: %s",prggrade);
    	printf("\n\nPRGMARK: %s",prgmark);
    	return(0);
    	getchar();
    }

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    333
    C programs can have more than one source file. It's normal to have a fairly short main(), then the rest of the program in functions, organised in files according to a logical arrangement of type.
    That's what the exercise is trying to get you to understand.
    stahta01 likes this.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    http://www.malcolmmclean.site11.com/www

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    31
    Can you please help me to add the source file?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    stahta01 likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Mar 2013
    Posts
    31
    Thank you very much Mr.Salem.

    You help me a lot. Thank you Boss!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Defines and Header file
    By hnparmar in forum C Programming
    Replies: 8
    Last Post: 03-25-2013, 01:47 PM
  2. namepaces and header file defines
    By manav in forum C++ Programming
    Replies: 6
    Last Post: 12-10-2007, 09:09 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 10:46 AM
  4. Replies: 4
    Last Post: 12-14-2005, 01:21 PM
  5. include library header in header files
    By Raison in forum C++ Programming
    Replies: 6
    Last Post: 09-27-2004, 02:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21