Friday, April 27, 2018

Pointers

Spending the evening focusing entirely on C. Just finished a fun tutorial on pointers.

// Using pointers in C/C++

#include <stdio.h>

void main()
{
    int a = 14;
    int* p = &a;    //Declares int pointer (p) pointing to (a)

    // Where does (a) live in memory?
    printf("Address for a is %p\n", &a);
    printf("Address inside p is %p\n", p);
    if (p == &a)
        printf("P is point to a!\n");
    else
        printf("P is NOT pointing to a!\n");
}


No comments:

Post a Comment

SQL

I've hit a wall in my SQL studies via the Khan Academy, and as such, I am engaging in additional studies prior to attempting to move for...