News for hackers. Stuff that matters.
Re:Begginer in C. Critique my code and give ideas? by plikan13 on Friday January 30, 2015 @08:22AM (#8971827)

  int get_number(char buffer[])
  {
    long int i = 0;
    char *p;
    if(fgets(buffer, sizeof(buffer), stdin) != NULL)
  {
sizeof(buffer) will always be 4 (or 8 if you compile 64 bit) because sizeof(pointer to char) is 4 (or 8). It will NOT be the size of the buffer that you pass as an argument. To fix this problem you need to change the function to

  int get_number(char buffer[], int buffer_size)
Also the buffers that you pass to this function seem to be too small.
Re:Begginer in C. Critique my code and give ideas? by zeved on Friday January 30, 2015 @10:09AM (#8972337)
thank you very much. i appreciate it!