Questions tagged [pointers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
306 views

Pointer Concepts

I am problem set 6 and very confused by the use of pointers. Please tell me the difference of these things first? What is the difference between char word[length] and char *word = malloc(sizeof(char) ...
1
vote
2answers
2k views

Checking the base address of pointer string

#include <stdio.h> #include <string.h> int main(void) { char *a="World"; char *b; printf("a=%p\n",&a); // Base address of a b=a; // Base address of a ...
6
votes
2answers
321 views

How can char* contain a collection of characters instead of a memory address?

I'm a little confused as to how C treats int* differently from char*. For example, in section, we see things like: int x = 5; int* ptr_x = &x; So, here, ptr_x points to the address in memory of ...
0
votes
1answer
35 views

CS50 Pset4 Logic Problem

I am 3 days into PSET 4 Recover. In PSET 4 we are supposed to create a program which inputs a memory card and scans through that memory card for the signatures of lost JPEG files. Once the header of a ...
0
votes
1answer
23 views

Pointer passed as argument, then suddenly goes null

In the main method I declare a character pointer pCharacter. I pass this variable to the setCharacter method and assign it an address and a variable gets assigned to that address. From what I ...
0
votes
2answers
422 views

different between pointers and pointer to arrays?

difference between -- char a[SIZE]; //Char array of size (SIZE) char *a; //character pointer. Points towards a char (a). char *a[SIZE]; // Array of pointer characters. char *(a[SIZE]); // Pointer ...