Dima
Manish
same issue with ON_CALL as well.
Shvmtz
Anonymous
Anonymous
It depends on the binding
Shvmtz
Binding ?
Anonymous
For instance let's say char a[100] = "string"
char b[100]= "str2"
Anonymous
You can use ptr=a[strlen(a)]
strcpy(ptr,b);
Dima
Anonymous
But now
Anonymous
For instance let's say char* a= "string"
char* b= "str2"
Anonymous
This is const
Anonymous
Also you can literally just
Anonymous
printf("%s%s",str1,str2);
Anonymous
Anonymous
Now you want to, say
Anonymous
Concatenate 2 strings
Anonymous
char *concat(char *str1, char* str2) {
char *ret = malloc(1+strlen(str1)+strlen(str2));
for(unsigned long i = 0; i<strlen(str1);++i)
ret[i]=str1[i];
for(i=0; i<strlen(str2);++i)
ret[i+strlen(str1)] = str2[i];
ret[strlen(str1)+strlen(str2)] = 0;
return ret;
}
Shvmtz
Anonymous
Anonymous
Anonymous
Oh you mean to say that strcat() follow the same procedure he described.
Anonymous
But mine was easy to understand for beginner 😔
Shvmtz
Yes 🤧
Shvmtz
Manish
Test runs fine with a raw pointer but I am not getting why this happens
Anonymous
😐😩
Anonymous
Anonymous
This is almost a standard string concatenation algorithm
Anonymous
I merely translated it to C from the assembly equivalent
Reeta
I'm not bro 😂
Dima
one more time and you’ll get warn or ban
Reeta
Identify the gender first 🙂
Reeta
Anonymous
BTW @Ritik_Tiwari you can optimize it further
Anonymous
Observe how I'm not modifying str1 and str2
Anonymous
You can make them const
Anonymous
And you can make variables to hold strlen() calls instead of calling the function every time
Anonymous
I never assume the compiler and GCC and clang both behave very differently at -O3
Anonymous
Alright
Anonymous
Hello
Anonymous
Anonymous
Hello everyone,
I'm trying to do a while where I make a sequence of 1 and 0 walk inside the positions. For example, a sequence of 5 positions starting from 0 to 4 would look like this:
11010
01101
10110
01011
10101
11010 / this last one does not need to be repeated since it is equal to zero
Anonymous
a bug on windows
Anonymous
offset = 0;
while (offset <= mmc){
a = 0;
b = 0;
int maior[mmc];
memset(maior, 0, mmc*sizeof(int));
while (a < mmc/pattern->v) {
for (c=0; c < pattern2->k; c++){
maior[((pattern2->onSlots[c] + a*pattern2->v) % mmc) + mmc % offset] = 1;
printf("offset %d", offset);
printf("maior %d-> %d\n",b, maior[b]);
b++;
}
a++;
}
for (k=0; k < mmc; k++){
if ((menor[k] == 1) && (maior[k]==1)){
//printf("ACHOU em %d, menor %d, maior %d\n",k, menor[k], maior[k]);
}
}
offset++;
}
Anonymous
however if I use mmc% offset it gives an error execution of the floating point image of the recorded core.
if i use offset% mmc it does not return 1 in position 0 and so on.
could someone help me?
Anonymous
Anonymous
https://www.geeksforgeeks.org/rotate-bits-of-an-integer/
Anonymous
Anonymous
I believe that I cannot use this function because there is a check in each position
Anonymous
Wht's this
Emir
Is sizeof operator compile time operator or run time operator?
MᏫᎻᎯᎷᎷᎬᎠ
Intel
Guys i need help
Intel
I have tried saving/ run my first hello program in windows os with .cc but it cant run as program pls what should u do?
MᏫᎻᎯᎷᎷᎬᎠ
Emir
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Emir
I edited
so sometimes it calculated run time, am i wrong?
MᏫᎻᎯᎷᎷᎬᎠ
Emir
okay thanks again
MᏫᎻᎯᎷᎷᎬᎠ
Please note that C++ ISO forbids variable array length
Francisco
Yeah
I guess we're talking about sizeof applied to a variable and not a type, am I right? And btw, in which cases does it evaluate at run-time?
Emir
Emir
Francisco
In C may be okay, in C++ I can't think of example for that
Intel
Need help guys
Intel
I have tried saving/ run my first hello program in windows os with .cc but it cant run as program pls what should u do?
root@x4041:~#
You need to compile it first
Intel