C: recognize variable type [closed] - c

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm learning C. I wonder whether there is an instruction or command to recognize the type of the variable.
To be more practical: I have a program which works with integers, I want to show an error message if the user inserts a real number when running the program.
Hope you can help!

This is not part of the C standard, but GCC has the typeof keyword.
You have to be using the GCC compiler for it though.

Related

C programming - loop [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Hello I am starting to learn programming and I would like to know this if someone could help me out.
If we know how many times will loop be done whats the easiest one to use?
You should use as a rule of thumb.
If know iterations --> for
If unknown iterations --> while
If at least one iteration (but not known) --> repeat

How to implement the printf function in risc-v? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Here's the C representation of what I'm trying to do in RISC-V assembly:
printf ("x=%d\n", x);
https://godbolt.org/ is an interesting site. If you paste in c code, it can be transfered into others, such as RISC-V assembly. The sample c code is available from menie.org/georges/embedded/small_printf_source_code.html. It does work. Good luck.
Here is a very simple printf (actually only integers and strings and no advanced formatting)
https://godbolt.org/z/sgMVs7
It is not my code - it is tiny ptinf from the atolic studio. But it is a good base to implement something simple but more decent.

Why don’t we have to call main function in C? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I just had a question that whenever I write code I had to call all functions (predefined or user defined) in order to use or execute them. So why we don't have to call main function?
The main function is defined by the language itself as the designated start of the program. You don't need to call it because, in effect, your operating system (Linux, macOS, Windows, etc.) does.

getting value from Timer0 AVR [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am currently writing a program in AVR Studio 4 in which i would like to use the Timer to get a random number.
I can get the timer to run, however i do not know how to get the current value of the timer. In general can the value be stored in a register or is it not accessible.
Thanks
Don't worry got it sorted. I managed to figure out that my program never got past 1 and managed to figure out how to store the values.

(.text+0xb6f): undefined reference to `src_simple' [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i am using libresample to resample a data. i have include samplerate.h in my C code but when i compile it there is an error displaying
(.text+0xb6f): undefined reference to `src_simple' is there anyone with solution. thanks
According to the gcc manual, "link options" section, you should be able to link to libresample, providing libresample.a is present in whichever directory your system uses for libraries, by invoking gcc your_file.c -lresample.

Resources