<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CODE for Call void function with parameter?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/33095/code-for-call-void-function-with-parameter</link><description> 
void PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
{
.
.
.
}

int main()
{

PWM_Config(); // THIS LINE SHOWS AN ERROR

.
.
.
}
 

 
ERROR LIST: 

 
main.c(251): error: #165: too few arguments in function call
PWM_Config(); 

 
BUT, If I write the</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: CODE for Call void function with parameter?</title><link>https://community.arm.com/thread/129150?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 00:01:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b5a9faaa-d27c-48d9-8e5d-4d198dd3f829</guid><dc:creator>Carsten Groen</dc:creator><description>&lt;p&gt;&lt;p&gt;
Maybe read this?&lt;br /&gt;
&lt;a href="http://www.shrani.si/f/T/jB/k4qOQd4/cfordummies.pdf"&gt;www.shrani.si/.../cfordummies.pdf&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CODE for Call void function with parameter?</title><link>https://community.arm.com/thread/117955?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2016 04:17:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a8b3f444-1d2e-4b44-923c-696aeccc179c</guid><dc:creator>Farhan M</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks. Got it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CODE for Call void function with parameter?</title><link>https://community.arm.com/thread/108644?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2016 04:11:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2638e8a7-46ca-47a3-a817-25e02f2aa710</guid><dc:creator>Kevin Pollark</dc:creator><description>&lt;p&gt;&lt;p&gt;
I normally don&amp;#39;t like responding to posts from consultants.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;Now this shows an error. I want to know the exact
reason.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
The reason is simple. You&amp;#39;re stating that the function PWM_Config
takes two parameters. Then you attempt to call it with none.&lt;/p&gt;

&lt;p&gt;
If you want to call it from main (or anywhere else), you MUST
supply two arguments to go with it.&lt;/p&gt;

&lt;p&gt;
Example:&lt;/p&gt;

&lt;pre&gt;
int main()
{

  PWM_Config(1,2)

  .
  .
  .

}
&lt;/pre&gt;

&lt;p&gt;
This is basic C!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CODE for Call void function with parameter?</title><link>https://community.arm.com/thread/83012?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2016 03:34:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fe520535-5bde-4ea2-b9c2-93a5c9eb18ea</guid><dc:creator>Farhan M</dc:creator><description>&lt;p&gt;&lt;p&gt;
please understand.I am not cleared with your words.&lt;/p&gt;

&lt;p&gt;
Initially, I programmed&lt;/p&gt;

&lt;pre&gt;
void PWM_Config()
{
.
.
.
}

int main()
{

PWM_Config();   // NO ERROR

.
.
.
}
&lt;/pre&gt;

&lt;p&gt;
The above program was been made, because some value is declared
within the program.&lt;/p&gt;

&lt;p&gt;
Now. the values are input from outside of program so I am using
COMMAND HANDLER so when I give certain value it should have to store
in the &lt;b&gt;TIM_PERIOD&lt;/b&gt; and &lt;b&gt;TIM_PULSE&lt;/b&gt; .&lt;/p&gt;

&lt;p&gt;
so I am rewriting the program,like below&lt;/p&gt;

&lt;pre&gt;
void PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
{
.
.
.
}

int main()
{

PWM_Config();   // THIS LINE SHOWS AN ERROR

.
.
.
}
&lt;/pre&gt;

&lt;p&gt;
Now this shows an error. I want to know the exact reason.&lt;/p&gt;

&lt;p&gt;
Moreover, I also want to know the write way to call this below
function from the int main()&lt;/p&gt;

&lt;pre&gt;
void PWM_Configvoid PWM_Config(uint8_t TIM_PERIOD, uint8_t TIM_PULSE)
&lt;/pre&gt;

&lt;p&gt;
Thank you&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CODE for Call void function with parameter?</title><link>https://community.arm.com/thread/69481?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2016 00:39:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0b3e1612-ada5-4896-9029-ead7fae5868a</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Is this some kind of joke?&lt;/p&gt;

&lt;p&gt;
You find it strange if the compiler isn&amp;#39;t happy when you tell
it&lt;br /&gt;
&amp;quot;This function takes x parameters - and they are of type 1, type 2,
type 3, ... - but I prefer to call it with a completely different
list of parameters/types?&amp;quot;&lt;/p&gt;

&lt;p&gt;
If you write the code for PWM_Config(), then you set the rules for
the parameters it should take - and then you need to follow these
rules.&lt;/p&gt;

&lt;p&gt;
If PWM_Config() is written by someone else, then you have to
follow the rules that &amp;quot;someone else&amp;quot; did set up when designing the
function.&lt;/p&gt;

&lt;p&gt;
If you buy a car with the steering wheel to the right, you just
can&amp;#39;t get in on the left side and expect to drive the car - you need
to adapt to the situation.&lt;/p&gt;

&lt;p&gt;
Next thing to realize here is that a function prototype with () in
C is a function prototype that doesn&amp;#39;t tell what parameters it takes
while in C++ it&amp;#39;s a function prototype for a function that takes
exactly zero parameters. In C, you are expected to write:&lt;/p&gt;

&lt;pre&gt;
int my_function_that_takes_zero_parameters(void);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
to explain that there exists a function - and that the function most
definitely do not take any parameters.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>