Eponymous
   



About
My Infrequently Updated Blog. The web-based journal of M. Forde, computer nerd, endurance athlete, and DeLorean owner


contact

Subscribe
Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

Flavors
There's more than one way to view this weblog; try these flavors on for size.

  • index
  • circa 1993
  • Sections

  • main
  • musings
  • running
  • DeLorean
  • code
  • unix
  • album
  • TBM
  • Archives

  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012
  • 2011
  • 2010
  • 2009
  • 2008
  • 2007
  • Disclaimers, Copyrights, Privacy, Etc.

  • ToS
  • Copyrights
  • Links

  • olix0r.net
  • netmeister.org
  • Giraffes
  • Eat. Run. Sleep.

  •        
    01 Mar 2012

    Just a Question
    Given the following code fragment, I was asked to implement foo such that the program would output "America." How would you do it?

            int main()
            {
              char *p = "Hello";
    
              foo(         );
              printf("%s",p);
    
              return 0;
            }
    

    My solution involved allocating new memory from the heap to store the new string, and changing p to point to that buffer. They didn't like that answer. They preferred the method of putting the new string in the data segment as well.

    I personally would always avoid that, whenever possible. "Hello" is stored in a read-only area of memory as is "America" in their preferred solution. Any attempt to alter those strings will trigger a segfault. This is an accident waiting to happen.

    [/code] [permanent link]


       
    Eponymous
    Eponymous
       



    About
    My Infrequently Updated Blog. The web-based journal of M. Forde, computer nerd, endurance athlete, and DeLorean owner


    contact

    Subscribe
    Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

    Flavors
    There's more than one way to view this weblog; try these flavors on for size.

  • index
  • circa 1993
  • Sections

  • main
  • musings
  • running
  • DeLorean
  • code
  • unix
  • album
  • TBM
  • Archives

  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012
  • 2011
  • 2010
  • 2009
  • 2008
  • 2007
  • Disclaimers, Copyrights, Privacy, Etc.

  • ToS
  • Copyrights
  • Links

  • olix0r.net
  • netmeister.org
  • Giraffes
  • Eat. Run. Sleep.

  •        
    14 Mar 2017

    Ninth Runniversary
    Yesterday was my ninth runniversary. Like my first day running, I ran on the treadmill while listening to Broken. Unlike the first time, I only listened to it once, and covered 4.48 miles during the duration of the EP, thanking God every step of the way.

    I'm confident in knowing that the bone in my ankle has healed completely now; however, I'm still rebuilding the muscle in that ankle and the rest of that leg. There was significant atrophy during the early phases of recovery. Slowly as it may be, I am making progress, and I am thankful for that.

    [/running] [permanent link]