« first day (2027 days earlier)      last day (1599 days later) » 

8:19 AM
@Kamiccolo Are you there?
 
@AjayMishra yup, morning :}
 
Morning, I used malloc in my last question, but I am getting a test crashed error in the end despite the fact that all the test passed but the last one. The problem seems to occur whenever I am using `malloc()/free()'. Should I send you the code, or is it the common problem?
 
@AjayMishra without a code it's difficult to say for sure :} A few common issues are: 1) calling free more than once on the same pointer 2) writing/reading past the allocated memory
 
#include<stdlib.h>
#include <stddef.h>
// return a *new, dynamically allocated* array with each element doubled.
int *maps(const int *arr, size_t size)
{
  int *a;
  a = (int *) malloc(size);
  for(int i = 0;i<size;i++)
  {
    a[i] = 2*arr[i];
  }
  return a;
}
 
8:36 AM
@AjayMishra You don't need to cast the result of malloc(). This is not C++. Except this, I don't see anything really wrong.
 
what do you mean by cast?
Sorry, but I have no experience in C, at all.
 
This part (int *)
 
 
6 hours later…
2:58 PM
Why is this printing "Sunday" instead of "Monday"?
  tm input_time = { 0 , 0 , 0 , 9 , 7 , 2010 - 1900 }; // 9 August 2010
  char buffer[10];
  strftime(buffer,10,"%A",&input_time);
  printf("%s",buffer);
 
3:41 PM
@aderchox hmmmm
 
@Kamiccolo mixture of your profile picture and this "hmmmm" is scary :D
 
I wonder. If You can do it like this. Because now, input_time is contradictive.
 
4:05 PM
Soooo, in Your case, none of these are not set: tm_wday, tm_yday, tm_isdst. So, no wonder stftime is showing You a bollocks :}

You could do something like this:
  struct tm input_time;
  strptime("2010-08-07", "%Y-%m-%d", &input_time);
And get the darn day of the week using strftime, or just by checking tm_wday
This must be pretty common "gotcha" :|
 
4:44 PM
Aah Ohh... Thank you @Kamiccolo
 
 
5 hours later…
10:02 PM
@Kamiccolo ahhhh
printf("Action: %"PRIu8"\r\n", evt); where uint8_t evt prints "Action: hu"
however, if I use PRIu16, and change to uint16_t, it prints the value... 0_o
 
11:04 PM
@Kcvin isn't it supposed to be hhu? o_0
have You redefined PRIu8? What kind of libc and environment is that?
 

« first day (2027 days earlier)      last day (1599 days later) »