OK, I will initialize my variables. Thank you for your help.
Just did it, and now it's working :)
Type: Posts; User: hzcodec
OK, I will initialize my variables. Thank you for your help.
Just did it, and now it's working :)
I have a problem of how to handle registering of a callback function.
In Example 1, I commented away reg_cb(f1); and in the function irq_handler() the check is working ok (callback = NULL).
...
OK, thanks for your comment.
I actually came up with this solution. Maybe this is the way to do it?
#include <stdlib.h>
void sayHello(int a)
{
printf("Hello: %d\n", a);
}
Hi,
I'm trying to pass a parameter via a function pointer. My first attempt without a parameter works but when adding it, it fails.
So this is without an in parameter to the function pointer in...
I prefer a simple if(a== b). It's just that I found this in one of our project and got a bit puzzled.
OK, Thanks for your reply.
I saw this in a project (simplified of course). Is that a good way to do it or should I use an if statement instead?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 10;
Yes, It's working. Thanks for the tip.
I'm trying to use a function pointer that is taking another function pointer with an argument. So f2() is the argument to the first function.
But I'm getting an error saying "error: lvalue...
OK, I see.
Regarding the "-W"and "-Wall" flags you are correct. I got a warning telling me "impilicit declaration ..."
Thanks for the clarification.
The #include "plot.h" in file1.c does'nt seem to make a difference.
If I remove the line with #include plot.h it still compiles.
I have a structure as below:
file1.c
#include...
Aha! That whas the problem.
Yes, sizeof(obj2) gave me 8 and sizeof(*obj2) gave me 12.
Thank you for your help.
Now it's working.
Hi,
I have trouble reading the last element in a struct.
I do get the correct value for the first two elements. In my example that is:
a = 11 and c = H
however I get:
b = 0
but I am expecting...
Aha, got it!
Thank you guys.
Mayby because it cannot divide anymore. It reaches its 'end'. I tried to exchange the '2' to '64' and I got only two iterations.
I found a for loop in an example that I don't understund fully.
for (i=64; i; i/=2)
printf("i: %d\n",i);
Now this is dividing by 2 until it reach '1' and stops.
But why does this stops?
Hi,
I have a piece of code that is demonstrating a linked list. What I don't understand is what's happening in the add function.
There is a pointer to a pointer '**q'. Further down a pointer...
OK ... 'return *c' did it. I have been trying to much so I got it completely wrong.
Thank you for your help.
Sorry, I don't understand how you mean. Should I use 'struct Coordinate CallF ...'?
Hi,
I have a problem with returning a struct that I don't understand.
This is just a part of my code. I get an "Incompatible types ..." error when I compile the code. I have been playing around...
Oh yes! I'm familiar with the shorthands. And with a little a bit of experimenting with the code I finally got it. Just confusing myself. laserlight got me thinking in the right direction. Thank you...
Well ... "v>>1" is shifting one step but what is the "=" sign doing in the for loop?
I have of course done this. However I still have problem understanding the "v>>=1".
I found a piece of code a while ago with a for loop that I don't understand. The purpose is counting the number of bits.
#include <stdio.h>
int main()
{
unsigned int i;
unsigned int v...