Go Down

Topic: [Paid] Is anyone willing to do a google hangout for about an hour to help me? (Read 328 times) previous topic - next topic

mudmin

I really appreciate the programming forum but I'm getting 75% of an answer and I think it would be extremely helpful if someone who understands C and pointers and structs who can walk me through a few things.  I'm guessing it would take about an hour. Let me know what you want and if you're interested.

boylesg

Google hangout? Oh looks like skype.

This might help with pointers.

In your C program you refer to the place in memory where the value 10 is stored as the variable nInt.

But the CPU in the microcontroller simply uses the address 0x0002.

If we had to refer to address 0x0002 etc in our C program we would all get impossibly confused as to which address contains which of our values.


boylesg

In that example nInt and *pInt are effectively identical as far as the CPU is concerned - both evaluate to address 0x0002

So if you did this:

Serial.println(nInt);
Serial.println(*pInt);

Both would output 10 in serial monitor.

mudmin

Thanks for the response. I definitely understand the gist. I'm just having problems converting it into something I can use.

I really would like to walk through my program and make sure that I understand certain parts.

arduino_new

I really appreciate the programming forum but I'm getting 75% of an answer and I think it would be extremely helpful if someone who understands C and pointers and structs who can walk me through a few things.  I'm guessing it would take about an hour. Let me know what you want and if you're interested.
Check your messages!

boylesg

Thanks for the response. I definitely understand the gist. I'm just having problems converting it into something I can use.

I really would like to walk through my program and make sure that I understand certain parts.
Try this example (not checked for compile errors):

Code: [Select]
   /* Pointer of integer type, this can hold the
    * address of a integer type variable.
    */
   int *p;

   int var = 10;

   /* Assigning the address of variable var to the pointer
    * p. The p can hold the address of var because var is
    * an integer type variable.
    */
   p= &var;

   Serial.print("Value of variable var is: ");
   Serial.println(var);
   Serial.print("\nValue of variable var is: ");
   Serial.println(*p);
   Serial.print("\nAddress of variable var is: ");
   Serial.println(&var);
   Serial.print("\nAddress of variable var is: ");
   Serial.println(p);
   Serial.print("\nAddress of pointer p is: ");
   Serial.println(&p);


As your programming skills develop it will become obvious where pointers are handy.

patduino

I didn't see anyone actually take you up on your offer. Did anyone help you or are you still waiting?
There are 10 types of people in the world, those who understand binary, and those that don't.

Go Up