Reverse morse code

The original code

Example of execution
Output of gcc -E of the original program

The transformed code

Transformed code
  • E and T are the 2 level-1 nodes, E is “.” while T is “-” in morse
  • I A N M are the level-2 nodes, I is “..”, A is “.-”, N is “-.”, M is “ — ”
  • etc…
  • first loop : gets a string from the user, with a preallocated max size of 81, stored in w1
  • second loop : goes through each letter of w1 and calls the function named function1, which takes the ASCII code of the letter and, via alphabet, translates it into “.” or “-”
  • last loop : converts all lower case letter into uppercase, to be then translated using the alphabet table

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Python Training In KPHB

How to Find A Product Manager Job With A Business Degree

What Every Software Developer needs to know about Requirements

Developers collaborating on a document

What I Learned Last Week: How to Display a Custom UIKit Subclass in the Xcode Interface Builder

Partitioning MySQL: Why, When, How?

Applying horizontal slicing to reduce risk during development.

Steve — The simplest calendar app money can buy for iOS

Key benefits of courier management software

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matt

Matt

More from Medium

Twinkle, Twinkle, Tinsel, and Kringle

A Commentary On Bukalapak Ep.1

Review — The Man Who Ran Washington

Nice People