5
votes
1answer
137 views

At ping, why do we have to do array copying instead of passing on the source array that the client sent to us?

So I have been googling about this OpenSSL heart-bleed thing and somehow sees that it is caused by the heartbeat extension which requires client to ping the server to show its aliveness and it all ...
1
vote
2answers
216 views

Choice between 1-dimensional and 2-dimensional array

I'm implementing the Chessboard class to represent the chessboard. I've to implement the transformations (reflections and rotations) on the chess board possible. The possible transformations includes ...
2
votes
3answers
446 views

How do you read this line of code?

Forgive me for my poor English, me and my friend were doing school homework, suddenly he asked me to read this line of code ptr = &array[1][1][1] (ptr is a pointer to an integer). He said ...
3
votes
2answers
438 views

Implementing non-fixed length array support in a compiler

I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this: Declare the variable as int[] Wait for input from serial connection Make the ...
4
votes
4answers
26k views

Initializing char array with string

I don't remember how I got to the thread, but I was reading its replies and one of them states that you should never initialize a char[] with a string literal. My question: Is initializing a ...
0
votes
3answers
668 views

How to efficiently store IP addresses? [closed]

Background I have a requirement where I need to remove a few nodes in a network based upon a command given by the user. To keep the nodes from transmitting or receiving data I thought of changing its ...
-2
votes
4answers
809 views

C simple arrays and pointers question

So here's the confusion, let's say I declare an array of characters char name[3] = "Sam"; and then I declare another array but this time using pointers char * name = "Sam"; What's the ...
3
votes
3answers
2k views

C Flexible Arrays: When did they become part of the standard?

I learned to program in C many years ago, and used C steadily for about 10 years. These days, I occasionally have to look at C code, because our Informix 4GL RDS customized runners also contain C ...
5
votes
6answers
794 views

why are both index[array] and array[index] valid in C?

For example consider: int index = 3; int array[4] = {0, 1, 2, 3}; then both index[array] and array[index] are valid expressions, much like *(index + array) and *(array + index). In C arrays why is ...