EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / Hi Monika, Interesting

Hi Monika, Interesting

|

Miscellaneous › Others › C program without writting main() function › Hi Monika, Interesting

February 24, 2013 at 10:05 pm #9177
AJISH ALFRED
Participant

Hi Monika,

 

Interesting question.

There is actually a main() there in your code.

 

Try to understand the meaning of the following macros.

 

 

#define decode(s,o,l,v,i,n,g)v##s##l##o

A function named ‘decode’ with 1st argument ‘s’, second argument ‘o’, third argument ‘l’ and so on, is defined as nothing but a ‘string’, formed by concatinating the following arguments in the order,

v – 4th argument

s – 1st argument

l – 3rd argument

0 – 2nd argumnet

 

Now this function is called by another function named ‘start’ which is defined as below.

 

#define start decode(a,n,i,m,a,l,s)

A function named ‘start’ with no arguments, is defined as making a fucntion call to the already defined function ‘decode’ along with passing value to 1st argument as ‘a’, 2nd argument as ‘n’ and so on.

 

Now the working! On this function call the function ‘decode’ receives the argument values as follows

No.     argument      value received

1               s                      a

2               o                      n

3               l                       i

4               v                     m

5               i                       a

6               n                      l

7               g                      s

 

 

Now what the ‘decode’ function is defined as?

It forms a string by concatinating the values of arguments in the order v, s, l, o

 

argument     value     concatenation process

v                    m               m

s                     a                ma

l                      i                mai

o                    n                main

 

You see how the main is made??

 

Simply, the function ‘start’ is defined as making a function call to decode which is alredy defined as generating a string ‘main’ on that function call from start.

Hence ‘start’ is indeirectly defined as ‘main’

 

It is like writing the following statement

 

#define start main

 

I hope this ‘animal’ has helped you in ‘solving’ your question much better than people from other forums do!!

 

You can concentrate on forums based on programming questions only. Since your questions will be answered by people who have spend major part of their life in programming, they will consider these kind of questions as silly once and you won’t get an explanation like the one I’ve given you on your question.

So I suggest you to try the people on other general technical forums like engineers garage’s before bothering experts on programming questions based forums.

 

 

RSS Recent Posts

  • Lightbox circuit May 16, 2025
  • I want to make a CRT with some modifications But i have no Idea where to start May 16, 2025
  • Kawai KDP 80 Electronic Piano Dead May 16, 2025
  • LT3511 Isolated Flyback Converter May 16, 2025
  • Funny Images Thread! May 16, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise