Meaning of the word hard coded

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rag84dec
    New Member
    • Mar 2007
    • 100

    Meaning of the word hard coded

    HI,
    I wud like to know the meaning of hard coding ....and a simple example...

    thanks
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Hi,
    See the following code
    Code:
    #define SIZE  100
    int arr[100]; ///Here 100 is being hard coded
    int newarr[SIZE];
    If you are declaring array at multiple places then if u want to change the size it will be easier if u use a #define for the array sze, as you have to change it at at only one place.
    Hope you are geting it.

    Thanks
    Raghuram

    Comment

    • rag84dec
      New Member
      • Mar 2007
      • 100

      #3
      Nope....Give me in general if they use that term what does it mean???

      Comment

      • gpraghuram
        Recognized Expert Top Contributor
        • Mar 2007
        • 1275

        #4
        Hi,
        I dont know how to explain the term hard coding in general...may be other members can help in this.
        Raghu

        Comment

        • rag84dec
          New Member
          • Mar 2007
          • 100

          #5
          Pls some one help...

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by rag84dec
            Pls some one help...
            Maybe this example can help:
            Code:
            #include <stdio.h>
            int main() {
               for (int i= 0; i < 10; i++)
                  printf("Hello world!\n");
               return 0;
            }
            This little program prints "Hello world!" ten times. You can't make it print it
            out eleven times or nine times, i.e. it is "hard coded" in the program that it
            prints it out ten times. You also can't make it print "Hi there!" so many times,
            i.e. also the text "Hello world!" is hard coded in the program.

            kind regards,

            Jos

            Comment

            • rag84dec
              New Member
              • Mar 2007
              • 100

              #7
              ok...thanks....
              One general definition will clear things up...

              Can anyone????

              Comment

              • stroken
                New Member
                • Mar 2007
                • 24

                #8
                Originally posted by rag84dec
                ok...thanks....
                One general definition will clear things up...

                Can anyone????
                Hard code refers to the software development practice of embedding output or configuration data directly into the source code of a program, or fixed formatting of the data, instead of obtaining that data from external sources or generating data or formatting in the program itself with the given input.

                Any help?

                Comment

                • r035198x
                  MVP
                  • Sep 2006
                  • 13225

                  #9
                  Originally posted by rag84dec
                  ok...thanks....
                  One general definition will clear things up...

                  Can anyone????
                  It could help if you give us an example now or any code you are unsure of.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32634

                    #10
                    Sounds like someone's been set an assignment they don't want to do themselves.
                    The meaning has been made clear, so it's the definition that is required obviously.

                    Comment

                    • JosAH
                      Recognized Expert MVP
                      • Mar 2007
                      • 11453

                      #11
                      Hard-coding -

                      Main Entry: hard code
                      Function: verb
                      Inflected Form(s): hard cod·ed; hard cod·ing
                      transitive verb: acting, popularized by computer keyboard manufacturers such
                      that the programmer bangs the keyboard using so much force that most likely
                      more than one keyboard will be needed to finish the entire program.

                      - hard-cod·able /'kO-d&-b&l/ adjective
                      - hard-cod·er noun

                      kind regards,

                      Jos ;-)

                      Comment

                      • ChaseCox
                        Contributor
                        • Nov 2006
                        • 293

                        #12
                        Originally posted by JosAH
                        Hard-coding -

                        Main Entry: hard code
                        Function: verb
                        Inflected Form(s): hard cod·ed; hard cod·ing
                        transitive verb: acting, popularized by computer keyboard manufacturers such
                        that the programmer bangs the keyboard using so much force that most likely
                        more than one keyboard will be needed to finish the entire program.

                        - hard-cod·able /'kO-d&-b&l/ adjective
                        - hard-cod·er noun

                        kind regards,

                        Jos ;-)

                        I like this definition, I think I am a Hard Coder :)

                        Comment

                        Working...