klimi
ye
klimi
i cant do anything about it
Nils
Hmm okay.. :-/
I'll just continue trying for now ig
klimi
klimi
@Neko_cpp should iremove the blacklist?
klimi
i could
klimi
ill give him a text
Anonymous
Dima
loool
klimi
klimi
2 warns... let me guess... DIMA?
Harsh
LMAO
In first condition, if x=y it'll go to else, while in second, it won't
noop
char* bhmac(char* data) {
 
      unsigned char *key = SECRETKEY;
      unsigned char *result;
      int result_len = 32;
      int i;
      //static char res_hexstring[32];
      char *resptr = (char*)malloc(sizeof(char)*32);
      result = HMAC(EVP_sha256(), key, strlen((char *)key), data, strlen((char *)data), NULL, NULL);
      for (i = 0; i < result_len; i++) {
        sprintf(&(resptr[i * 2]), "%02x", result[i]);
      }
      return resptr;
 }
Here, you have defined memory inside the function, and somewhere else you have to release it, which can icrease the possibility of error if the programer forgets that.
It is a good habit to define and release the memory in the same place. You could feed the resptr as the second argument to the function:
int bhmac(char *data, char **resptr)
{
char *res = 0;
res=(char*)malloc(...);
if (!res)
return 1; // error in allocation
*resptr = res;
..
return 0;
}
And in the place you call this function:
char *resptr = 0;
if (bhmac(data, &resptr))
return 1; // error
...
if (resptr)
free(resptr);
resptr = 0;
Artöm
Which is explicitly stated in this link. He wants a strange thing, gonna try hard
Serenity
Hey
Serenity
Write a function that gets a matrix reference and reads the input to the matrix from the
user. If the input is non-zero replace it by 1. If the user did not enter enough values
before the end of the line, the remaining cells in the matrix will be populated with zeros.
Also make sure if the user inputs too many characters, you only take what's needed and
discard the remaining input. (Eg: 1509 is a 2x2 matrix with values 1101, and ‘1 5 ‘ is also
a 2x2 matrix with values 1111, the highlighted whitespace is taken as a 1 as discussed
above.)
Function signature:
Serenity
I wrote a function that works fine under 25 elements, but as I enter more than this value , it leaks into the second function call.
Serenity
int i, j = 0;
char x;
int flag = 0;
for (i = 0; i < SIZE; i++)
{
for (j = 0; j < SIZE; j++)
{
x=getchar();
if (x == '0')
mat[i][j] = 0;
else if (x == '\n')
{
flag = 1;
break;
}
else
mat[i][j] = 1;
}
if (flag == 1)
break;
}
Serenity
Madhu It is why I was talking about yesterday..
Serenity
I can't implement a stopping condition.
Serenity
Yes now I have the instructions in front me fortunately
Serenity
I can't think of any idea how to solve it.
Serenity
I placed a condition outside the nested loops and it hasn't worked either..
Serenity
Do you mean using fgets ?
Serenity
Isn't it possible to do it this way with a little addition ?
Serenity
What will happen if I define a 25 chars long string by fgets and the user inserts more ? would the excessive values be ignored then ?
uncle
Serenity
Okay I'll give it a try. I've been instructed to this quite differently but what you suggested had been my initial idea..
Serenity
I may not use the string standard library
Serenity
But okay I get what you said
Serenity
but if you have an idea how to change my code to meet the requirements , let me know as well.
Serenity
that is what I have done and it has not worked
Serenity
Ok.
Serenity
How can I discard them ? How to make them not slip into the second matrix ?
Serenity
And what does it even happen ? Is it related to getchar() functionality ?
Serenity
Thanks a lot ! I got my logical mistake, and I'll try the second way you suggested which seems to be a little more efficient.
Anonymous
Hi guys! how to set the char * value in a class from one method for different fields in c++
Anonymous
for example i have
class Advertising {
private:
char * advertising_name;
char * client_name;
how to set advertising_name and client_name from one method
Zel
Did you even read the question? Look really hard at the symbols those two equations do not produce the same result
klimi
some function (params):
advertising = some param
client = some param
end
Anonymous
thanks
Zel
x > y is not the same as y <= x .
Zel
I disagree, but Im not gonna aurgue over it.
Harsh
I answered accordingly :)
Harsh
Harsh
Oh true
Harsh
I'm sorry
Dima
lol
Harsh
I surely won't put someone down next time
Sorry
Zel
That was fast
noop
If x=5 and y=3, these are the outputs:
A: x is the greater.
B: x is not the greater.
Anonymous
achievement unlocked: read upside down photo
Anonymous
actually you are wrong. the question inverted three things 1) the operator, 2) the strings, 3) the variables. if they did only 1 and 2 the answer would have been same.
Zel
Dont worry about it. :3
Zel
I just confused the auto rotate on my phone so I could read it easier
Anonymous
i just realised a pun(?)
Anonymous
Zel
Yeah it was upside down
Anonymous
ye
shandy
Hallo
Zel
Hello
klimi
Hello
Anonymous
hello my dudes
Anonymous
can I share sum quick code I can't seem to find the error
Anonymous
It's not on stack overflow tho
Anonymous
oh shoe it's in spanish no problem (?)
klimi
you can try
Hackman
Hackman
that is my source code
Anonymous
Anonymous
vector<int> v = {1,2,2,2,2,2,2,1,1,1,1,1,3,3,3,3}; I have 6 1's and it gives me one less
Artöm
Show 2 other functions
Anonymous
Artöm
And apariciones?
Artöm
Btw you access element past the last here
Anonymous
Anonymous