Anonymous
anyone knows the answer ?
Artöm
Anonymous
that it is
Anonymous
this book is funny
X3eRo0
lmao
contestent[2] points to contestent [0]
X3eRo0
But contestent [2] is a pointer
X3eRo0
So will it print the pointer value or the value at the pointer
Anonymous
So will it print the pointer value or the value at the pointer
it will print the value stored in the memory address
Anonymous
pointer values are simply memory addresses
Anonymous
they also have their own memory address
X3eRo0
Yeah it's not printf("%d", *contestant[2])
Artöm
Artöm
But not point to another element
X3eRo0
No, they have same value
i didnt understand pls elaborate
X3eRo0
look if it was printf("%d", *contestant[2]); then it will print 2 but now it will print the pointer address
Artöm
It isnt possible to dereference int
Artöm
contestant[2] is int already
X3eRo0
yeah man
X3eRo0
since constant[2] = *choice
X3eRo0
its equal to the value at *choice
X3eRo0
so yeah it prints 2
X3eRo0
Anonymous
when would you use fgets?
Anonymous
you can also run it through the compiler
Anonymous
X3eRo0
Yea
Anonymous
what text editor are you using
Anonymous
looks similar to sublime
X3eRo0
Sublime text 3
klimi
bingo
Anonymous
o i need to update my sublime, i use sublime because its light weight and easier for learning, i have VSCode also but barely use it
Anonymous
duplicate symbol _tracks in: /var/folders/jv/gt5mbyk170j48353rjjl46c40000gn/T//ccp5td8L.o /var/folders/jv/gt5mbyk170j48353rjjl46c40000gn/T//ccqlRDms.o ld: 1 duplicate symbol for architecture x86_64 collect2: error: ld returned 1 exit status
Anonymous
i getting this error when trying to compile
Anonymous
Made me sad
first editor i used with C 🙂
Body
Body
I_Interface
/report wtf
Body
Is here anybody who can help me to release insertion sort with such kind of output. I wrote an algorithm but i have problems with output
Anonymous
void print_reverse(char *s){ size_t len = strlen(s); // holds the value of the length of the string literal char *t = s + len - 1; // s is a pointer to the first value in the s string literal //s + len moves it to the null character // 0 1 2 3 4 5 \n // minus 1 moves it to the last character in the string while(t >= s){ //so at this point t starts at the end of the string printf("%c", *t); //then it prints the t //then subtract 1, or pointer math , so moves it // one memory address before the last //until there is no more letters in left t = t - 1 ; } puts(""); }
Anonymous
i have this function that is suppose to reverse a string , my question is , the part where it says t >= s in the while loop, what does that mean exactly , and does my comments reflect the logic behind this function ?
Anonymous
Hey
Anonymous
https://youtu.be/FRTmkDiW5MM
Francisco
https://youtu.be/FRTmkDiW5MM
I saw it yesterday. Just mindblowing
olli
0 ) the func must be void print_reverse(const char *s) 1) s is not necessary a string literal. It may be any ASCIIZ string. 2) t = t - 1; MUST BE --t; or nobody could believe you are a C programmer. 3) last puts better to do with "\n" All the rest is ok
0) compiler will issue a warning (discarded-qualifier) / C++ refuses to compile 2) why must? It can be.. the generated assembly by GCC 9.2 is identical 3) why two newline characters? puts already adds one
Anonymous
How to develop logic
Talula
How to develop logic
Small steps… that is how logic is done, you have to break those steps into what computer can understand in least.
Anonymous
I m good in thoery but my programming skill is weak
Talula
For example if you someone enters your name and you want to check the name to display something that is logic but you have to break it into what the language (computer) can understand.
Talula
Aren’t you?
Cristina
dat racism tho
Ilya
How to develop logic
Please stop it and write full understandable question. Related to C++
klimi
dat racism tho
Its true tho...
Cristina
I actually don't know, 'cause I've never been in the field (job-wise) and I've nevet met an Indian
Cristina
I don't know how they work tbh
Cristina
Why is it true? I am curious now lol
Anonymous
Is it possible to write self modifying function in C language If it is possible how can we write it?
Anonymous
If else elseif select case…
I don't understand
Talula
I don't understand
You could use these in your function so it’ll change depending on input...
Anonymous
Ok thanks.. 👍👍
Anonymous
Anonymous
Why do you need it?
In a group I found a programming challenge to write a self modifying function..
Talula
It doesn't seem like what the person wanted
Actually I was going to say if you want to use AI, then don’t use C use something else … but he said “Ok thanks”… so I stopped.
Anonymous
In a group I found a programming challenge to write a self modifying function..
And what do you mean by self-modifying function? Examples please