no passing arguments but return char type

WBahn

Joined Mar 31, 2012
32,878
Actually, I owe you an apology. Usually, true and false are defined as 1 and 0, respectively, and the contrast on your green #define statements was such that I didn't notice the apostophes. So, yes, since you are defining true to be '1' (which is probably 49) and false to be '0' (which is probably 48), then you are okay -- just don't try to use your true and false as logical values!
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
Thank you very much @WBahn for helping me!

But the my original question is still unanswered. I am looking example where we need a function that doesn't take any arguments and that returns a value of type char in embedded system.

@MrChips I am waiting for your response. Why do you think that simple C and Embedded C are not different?
 

MrChips

Joined Oct 2, 2009
34,829
Thank you very much @WBahn for helping me!

But the my original question is still unanswered. I am looking example where we need a function that doesn't take any arguments and that returns a value of type char in embedded system.
Here is one example:

char getc(void)

@MrChips I am waiting for your response. Why do you think that simple C and Embedded C are not different?
C and Embedded C are not different.

Your question is backwards.
If simple C is different than Embedded C then there must be differences.

If simple C is not different from Embedded C then there is no response because they are not different.
 

WBahn

Joined Mar 31, 2012
32,878
Thank you very much @WBahn for helping me!

But the my original question is still unanswered. I am looking example where we need a function that doesn't take any arguments and that returns a value of type char in embedded system.
HOW MANY EXAMPLES DO YOU NEED!!!

You found one. I gave a couple others.
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
Here is one example:
char getc(void)
You have just declared prototype function. There is no much information about your function. You didn't mention what character your function return and when it return character. You have not mentioned any condition
HOW MANY EXAMPLES DO YOU NEED!!!
I just need two or three example's. I gave one example for LCD and Keypad. Get the key number from keypad and display that number on screen. I expect this type of example from you. I just need only example so that I will try to write function in programming.
 

MrChips

Joined Oct 2, 2009
34,829
Oh, you want me to fill in the code for you?

char getc( void )
{
... your code here
}

No. That is your exercise. See if you can fill in the code.
 

MrChips

Joined Oct 2, 2009
34,829
I just need two or three example's. I gave one example for LCD and Keypad. Get the key number from keypad and display that number on screen. I expect this type of example from you. I just need only example so that I will try to write function in programming.
Oh, we're getting demanding here.

No, we are not going to do that for you.
This is your exercise, not ours.
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
No. That is your exercise. See if you can fill in the code.
You are repeating my question look my first post #1.
Oh, we're getting demanding here.No, we are not going to do that for you.
This is your exercise, not ours.
You are taking me in wrong way. I am not demanding you to make program for me. I am not asking for any program. As I said I gave one example for LCD and Keypad. Get the key number from keypad and display that number on screen. I expect this type of example from you. I just need only example so that I will try to write function in programming
 

Brian Griffin

Joined May 17, 2013
64
There are way too many combinations available to list down the function that takes nothing but returns an 8-bit char. It could be:

key = scanKeypad();

or status = GetLCDStatus();

or anything else, depending on the behaviour of the code flow.
 

WBahn

Joined Mar 31, 2012
32,878
You have just declared prototype function. There is no much information about your function. You didn't mention what character your function return and when it return character. You have not mentioned any condition

I just need two or three example's. I gave one example for LCD and Keypad. Get the key number from keypad and display that number on screen. I expect this type of example from you. I just need only example so that I will try to write function in programming.
I already gave you examples. Reading a value from an input port, reading a value from a buffer, reading a value from a communications device. Or how about generating a random byte value?

There, that's four examples.
 
Top