Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Most C programmers are faggots

Name: Anonymous 2012-01-29 19:36

I'm getting really irritated at a lot of self proclaimed C programmers for abusing the fuck out structures and pointers. It's easy to get out of hand and make your code look like shit and it seems people want to do it even when it's not necessary. The problem is even a lot of legitimately experienced C programmers do the same shit. Go look at the source to your favorite software written in C.

A good example is that stupid dubs checker thread that faggot just made. It should be written like this


#include <stdio.h>

#define base 10

int check(int i, int b) {
  return(i%b == (i/b)%b);
}

int main(void) {
  int i = 1;
 
  while(i++ < 100)
    if(check(i, base))
      puts("nice dubs bro");
     
  return(0);
}

Name: Anonymous 2012-01-30 18:13

>>82
An array's name is primarily used in the following contexts:
To pass it to a function - example: f(arr) - in which case what is passed is the address of the first element.
To access one of its members - example: arr[i] - in which case it is converted to the form *(arr+i), arr again replacing the address of the first element.
To assign the array's first member to a pointer without specifying which member in the previous form of arr[i] - example: int *ptr=arr - in which case the array's name is again synonymous for the address of the first element.

In every context in which an array's name is used, it is treated as the address of the first element. Thus one can think of an array's name as a pointer who's value cannot be changed.

Even in the internal representation, if you want to access anything, you need its address.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List