Access over 20 million homework & study documents

Creating a pointer

Content type
User Generated
Type
Study Guide
Rating
Showing Page:
1/1
Creating a pointer
Pointer what is located at specific memory address.
int total = 5;
int *pointer = &total;
printf(“The total is: %d “, <what is the memory address of> pointer);
//The * sign means the dereference operator (look at the value located at that memory address in
function printf)
Changing data and memory address of a pointer
char total = abc123;
char *ptr = &total;
*ptr = 10; //changes the value of variable total
ptr = ptr + 1; //changes the memory address with 1 byte. It is 1 byte because the variable pointer
//it is of char type.
1000 : 0110 0001 : ‘A’
incrementing

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Creating a pointer Pointer – what is located at specific memory address. int total = 5; int *pointer = &total; printf(“The total is: %d “, pointer); //The * sign means – the dereference operator (look at the value located at that memory address in function ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just what I was looking for! Super helpful.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4