Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
2 answers
58 views

Why can you say the name of an array is a pointer to the first element of the array in C?

I have tried to understand why you can say the name of an array is a pointer to its first element in C. Could you please tell me if my understanding below is correct? Both the name of an array and the ...
Yuya Ito's user avatar
0 votes
1 answer
27 views

Why am I able to insert an element into a hash tree via Main() but not via a function call?

I'm fairly certain this has something to do with pointers and the function using copies instead, but I'm not sure how...because I've inserted the pointer as a parameter for create(); #include <...
Krishaan Khubchand's user avatar
0 votes
1 answer
70 views

Declaring an array of structure pointers

How to declare an array of structure pointers? I need to create a collection of linked list. Is it same as declaring ordinary arrays? If
Basil Kuriakose's user avatar
0 votes
1 answer
2k views

Pset4 - Recover (usage of sprintf)

When I am working on Pset4 - Recover, I realize I do not understand the concept of array and pointer. Although I finally worked it out, I would be very grateful if you guys can explain the following: ...
Alex Yu's user avatar
0 votes
1 answer
108 views

difference between string, pointer, array and int

while it hasn't been something which really stopped me from learning, there is something which has been keeping me awake for the last few days... What is the difference between: #define x 5 int i; ...
Vincent's user avatar
  • 58
0 votes
1 answer
247 views

I've use array pointer method in pset2 (initials.c) but it return "Segmentation Fault (Core Dump) Why?

I'm working on pset2 using array pointer method, but unfortunately, the program return "Segmentation Fault (Core Dump)" I've post a picture of my code below.Can I use this method? or I have to use if ...
hackinteachk's user avatar
0 votes
0 answers
70 views

Initializing a variable in a struct, then in a function

It won't allow me to initialize the array to NULL in the struct in the header file: typedef struct frog { bool is_frog; struct frog* french_chef[10]; // eg = {NULL}; } frog; which I get, but ...
Gibb Johnson's user avatar
0 votes
1 answer
6k views

How to iterate through an array using pointers

I managed to "solve this issue", but I don't know why I get the problem I get. Right after the last line I also got a segmentation fault, which I failed to include in the above screenshot. My ...
Jon's user avatar
  • 21
24 votes
2 answers
80k views

Difference between char and char* in c

suppose we declare two variable char s[]= "hello" char* p = "hello". what is the difference between these two?
Chinmay Shah's user avatar
0 votes
2 answers
636 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 ...
Prateek Pande's user avatar
0 votes
1 answer
151 views

unable to use a 2d array via function

#include <stdio.h> void array(int *ar,int row,int col); int main(void) { int a[][2] = { {1,2}, {3,4}, {5,6} }; ...
Prateek Pande's user avatar
0 votes
1 answer
923 views

Can I create and initialize arrays of other types the same way I can create and initialize char arrays?

I'm a little confused about arrays and pointers and what is correct. I know that you can use char* str = "foo"; which is a pointer to the first block of memory for the string foo. But let's say ...
user avatar