Asdew
Strcpy only copies until a null byte, \0, including the null byte.
Asdew
Are you copying to or from that 100-element array?
Serenity
I'll give you a short example.
Serenity
char *str1 = " Hello world"
Serenity
char str2[100] ={'\0'};
Serenity
strcpy(str1,str2);
Asdew
Str1 will in memory be a pointer to memory where there is [' ', 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\0']. Strcpy copies to str2 until the null byte, including it, to the start of array str2. It doesn't care what there is in str2 already.
Alex
strcpy(str1,str2);
this is illegal, you can`t copy to const memory
Asdew
You could even strcpy to an int, but the result won't be very useful.
Stefan
strcpy(str1,str2);
segfault due to writing to potentially constant pool memory
Anonymous
Hey can anyone help me out i am stucted with some questions
Anonymous
Anonymous
I tried a lot but not getting can anyone please help
Alex
I tried to build house but not getting. please help
Serenity
Can int **a be considered as an array of pointers ? Or is it just a pointer to a pointer ?
Anonymous
It can point to array of pointers but it's not an array of pointers itself
Serenity
And int *a[] is definitely an array of pointers right ?
tim
yes
Serenity
So my question is how to correctly dynamically allocate an array of pointers ?
Serenity
Is that c++ ?
Serenity
in C
tim
Depends, you can use int i[n]; With n being a variable
tim
But this allocates the array on the stack. So it should not be used for large n
tim
For Heap allocations, use calloc
Stefan
Can int **a be considered as an array of pointers ? Or is it just a pointer to a pointer ?
yes, like int *a[] or int a[][<CONSTANT>] but not int []a*, not even if you used typedef
Stefan
this is known as pointer-array decaying rule
Stefan
int []a*; is not even valid C
that why i said not you idiot
tim
that why i said not you idiot
But why would you even post that?
tim
It is kinda trivial that a syntax error cannot be considered an array of pointers
Anonymous
Hmm
Stefan
But why would you even post that?
because it is valid in c#
tim
perhaps \0 missing?
tim
Stefan
OOB
Stefan
or maybe your allocated buffer wasnt zero cleared
Anonymous
Heyy
Anonymous
Here anyone know how to hack whatsapp?
Pavel
Here anyone know how to hack whatsapp?
you haven't read the rules, have you?
ding
hello😁
Anonymous
Hi ..i'm new here
V01D
Here anyone know how to hack whatsapp?
What does that even mean, "hack whatsapp"?
V01D
The company? An account? A password? Seriously, go educate yourself before asking stupid questions.
su
i'm wrining mm using two stacks one for available blocks of memory and another for used one. who is interested to share it expeience on that, it is more game/small objects related, so i plan to alloc 1 gb of memory once and use it internally with mm (i'm using pure C code)
Anonymous
Anonymous
what is difference in these cases ?
Anonymous
first one I modified myself,since I didn't understand the second one
su
you call it twice in first example
Anonymous
I can't understand ,how ifprime now it returned 0 or 1
Anonymous
Iam following k.n.king second edition do anybody suggest me better one ?
Saron Ravuth
Hello guy!!!
Saron Ravuth
Anyone help tell me some tip how to study C programming or python by self study???
Saron Ravuth
Or by any website
Anonymous
Here anyone know how to hack whatsapp?
You can easily do so with libstdhack++ #include <iostream> #include <hack> auto main() -> int { if(hackwhatsapp(enter number)) cout<<"WhatsApp hacked"; else court<<"WhatsApp not hacked"; }
Asdew
Account may not exist or server down
Doesn't the documentaiton say that it'll always turn the server on if it's on and create an account with the number if one doesn't exist?
Asdew
deprecated
Ohh, my mistake.
Anonymous
Ohh, my mistake.
libstdhack++ was built by gnu
Anonymous
Everything is deprecated
SK
hi, i am struggling with a piece of code, i am implementing a trie data structure but while inserting get this error "Runtime error: member access within null pointer of type 'struct treenode'" at line 18,24 in below code. i searched and found it is due to pointer pointing to NULL. But i assigned the pointer named "curr" before using. Pls help.. here is the link : https://ide.geeksforgeeks.org/fLuk9rPzdm "
Ok
Guys anyone can provide me c language drive links to learn
Kenny
/get cbook
Kenny
Ak .
Karan
so, there is a callback function called FirstInterestDataDelayCallback that has an attrib called hopCount. How do I call this said funtion so that I can get the value of hopCount in my call?
Karan
This is from a fork of NS3 called ndnsim. Documentation for the same: https://ndnsim.net/current/doxygen/classns3_1_1ndn_1_1Consumer.html#aa897934eaccbc1ed43b7b53011266ba7
Nils
Does the fork die when the parent does?
vinícius*
nope, it can become an orphan process (not a joke)
vinícius*
you can use prctl (on Linux) to force a SIGHUP to the child process when the parent dies
Anonymous
how could i ignore ctrl-c and bind ctrl-d for termination in my programs which are written in C ?
Alex
handle SIGINT
vinícius*
Ctrl+D by handling EOF