ʙʀʜᴏᴏᴍ ⑇
Thanks a lot
christian
You mane that when if I declaring an array of char the last index is for '\0' but if the array is int so there is no need for the '\0' at the last index
You see, \0 is a special character. It is totally different from the integer 0. You see, the compiler isn't so smart to know that it has reached the end of a string, so we use \0, which is called a terminating character, to tell the compiler that. But for integer arrays or any other type of arrays, you have to specify the size of the array, and this is how the compiler will know that it has reached the end of an array, if it is traversing through it.
Trailer park boys
Can c++ do a program that identifies faces as male or female, anyone here ever tried??
Ludovic 'Archivist'
I don't remember if someone here asked for my blogpost on benchmarking but here it is: https://archivist.nekoit.xyz/correct-benchmarking/
klimi
Can c++ do a program that identifies faces as male or female, anyone here ever tried??
i wouldn't try this nowadays since indentifying male or famale is impossible
Ludovic 'Archivist'
Can c++ do a program that identifies faces as male or female, anyone here ever tried??
Datasets that are good are rare, and unless you are ready to throw out a gigantic neural net that will take 90 to 200 seconds you will probably be at around 90 to 95% accuracy
Ludovic 'Archivist'
Quick reminder of what accuracy means here:
Ludovic 'Archivist'
TP = true positive TN = true negative TP + TN + FP + FN = all classification attempts
Anonymous
write (1, &c, 1);
Anonymous
char c; c = 'z'; while (c >= 'a') { write (1, &c, 1); c--; }
Anonymous
i understand what does it do and how does it work
Anonymous
but could someone explain this part
Anonymous
write (1, &c, 1);
Anonymous
i know that write &c is a reference of the c variable but the number 1 at the start and at the end of the condition ,i didn't understand there meaning
Phil
write(stdout, &c, size 1 byte)
Phil
But I recommend you to write stdout instead of 1 cause that's clear to understand at the first glance, and it is more appropriate
Nitesh Kumar
https://www.programassign.com/?m=1
Phil
it give an error if i change the 1 to stdout
Yeah cause you need to explicitly include stdio.h (if it's not that than it's maybe unistd.h or stdlib.h)
Phil
Ah
Phil
Let me check so
Anonymous
#include <unistd.h> #include <stdout.h> void ft_print_reverse_alphabet(void) { char c; c = 'z'; while (c >= 'a') { write (stdout, &c, 1); c--; } } int main() { ft_print_reverse_alphabet(); }
Anonymous
i changed the
Anonymous
#include <stdio.h>
Phil
ok my bad, https://stackoverflow.com/questions/59188184/get-file-descriptor-of-stdout-c according to you can't write write(stdout, &c, 1) due to the fact that stdout is considered as a FILE * but write(int fd, const void *__buf, size_t __n) so if you would like to still write the word stdout you should write something like write(fileno(stdout), &c, 1) wich is not pretty, so yeah my bad to sum up keep writting write(1,&c,1) PS and yeah you messed up it's not #include <stdout> but #include <stdio.h> (standart Input Output) @Rida2015
Phil
@Rida2015 If you're allowed to use stdC99 with suckless/BSD style you can rewrote your code snippet like this : C void ft_print_reverse_alphabet(void) { for( char c='z' ; c >= 'a'; c-- ) write (1, &c, 1); }
ֆ33ʏ377
any IDE suggestions so i dont have to install packages manually in C++
ֆ33ʏ377
Thanks in advance
Phil
You return 0 if you want to return the number then multiply the pos by the convinent power of ten and sum them all
● Igor
guys
● Igor
any idea how some programs prevent keyboard events propagations?
● Igor
for example: pressing alt + tab on virtualbox won't do anything on my host machine, because virtualbox prevents it to getting to my host machine desktop
● Igor
synergy is another program that does something similar
● Igor
synergy is another program that does something similar
its used to control multiple computers with a single mouse and keyboard... but how it prevents my computer from processing some shortcuts while my mouse is in another machine?
● Igor
maybe virtualbox uses some complex solution since it is a virtualization software, so maybe synergy is a better example
klimi
if you use x it is quite easy... just use xlib to catch the keycodes and modiify them if necessary. we have used it a little too https://gitlab.fi.muni.cz/unix/noctrl
▪️fateme👷🏻‍♀️
#include<stdio.h> struct node { int data; struct node* next; }; int main() { struct node *newNode; newNode = malloc(sizeof(struct node)); newNode->data = 4; struct node *head=newNode; struct node *temp = head; for(int i=2; i < 4; i++) { if(temp->next != NULL) { temp = temp->next; } } newNode->next = temp->next; temp->next = newNode; temp->next=NULL;** while(temp!=NULL) { printf("%d",temp->data); temp=temp->next; } I wrote this code and this code has 4 as output In this code we have temp->next=newNode; temp node is referring to newNode In the next line it is written temp->next=NULL; and I used the while loop to print output, the output was for against my expectations after I had inserted NULL as the next element of temp I was expecting to print nothing, because I had changed the reference of temp->next So my question is: why it still has 4 as output???
Sleeves
learn to diiferentiate ‘1234’ from “1234"
Faramarz
For a problem about designing computer I calculated the clock rate of computer A and computer B, can use them to conclude how much computer A is faster than computer B?
Anonymous
Are you learning linked list or working on something?
Because i think that code is pretty messed up You have assigned newNode to temp next, earlier in the code you wrote head=newNode and temp=head so basically temp=newNode You getting my point? 😅
Anonymous
Code in C : char curr[] = “JJJ”; I get a syntax error when running a simple line. I do not see the syntax error
Aquatica
Aquatica
"" is different from “”
Anonymous
maybe virtualbox uses some complex solution since it is a virtualization software, so maybe synergy is a better example
You know that synergy core is open sourced right. You can look at their code for Windows, OS X and Linux (X and Wayland) and see how they are doing it. https://github.com/symless/synergy-core
m
Hi everyone, I have a use case where my program has really big arrays pre-initialized with values, clang takes a very long time to work on it is there is a way to speed up the process?
m
I am basically implementing a CNN in High level synthesis using Vitis-HLS which uses clang
Ludovic 'Archivist'
Hi everyone, I have a use case where my program has really big arrays pre-initialized with values, clang takes a very long time to work on it is there is a way to speed up the process?
If compiler optimisation on these arrays is unimportant, you can generate them in a binary file and then memory map said file
Ludovic 'Archivist'
If you need to modify the arrays afterwards during execution, you can map them with MMAP_PRIVATE or whatever the option is that will make them copy on write
Anupam2.7
What is the scope of variable if it is defined outside int main() and def functions?
Nir
What is the scope of variable if it is defined outside int main() and def functions?
It's global variable in that case , that variable can be accessed by any of the functions
Anupam2.7
It's global variable in that case , that variable can be accessed by any of the functions
Those variables which are defined in int main() are also global, right?
/
help
/
i need help to place a variable always in a register
/
i tried using volatile register
You know me
i tried using volatile register
register keyword is now depricated
Anonymous
Please do anyone of you know any group that teach c++ for beginner
Anonymous
Sorry YouTube channel
christian
Those variables which are defined in int main() are also global, right?
Global variables are usually defined outside all functions, mostly below where you include your header files
christian
What is the scope of variable if it is defined outside int main() and def functions?
In C, any variable defined within a block (inside opening and closing curly brackets) are usually local to that very scope. For example, if a variable is defined either as a parameter to or inside the main function, it is only accessible inside the main function.
Anonymous
It this []
Anonymous
how to reduce a size stub on c? Compiler Gcc on windows
klimi
help me
tldr; you can't. it is up to the compiler to decide (maybe you could write asm code but meh)
Ludovic 'Archivist'
i need help to place a variable always in a register
Erm, why? How would you handle that on a target with no registers?
Ludovic 'Archivist'
Anonymous
Hello everyone 😊 Are there any YouTube channels and books you recommend that I can use while learning C and C++ languages? Thank you so much 🙏
/
tldr; you can't. it is up to the compiler to decide (maybe you could write asm code but meh)
loc_CD84: mov rax, [rbp+var_28] add rax, 4 mov [rbp+var_28], rax mov rax, [rbp+var_28] mov ecx, [rax] mov [rbp+var_48], ecx mov rax, [rbp+var_28] add rax, 4 mov [rbp+var_28], rax mov ecx, [rbp+var_48] mov edi, ecx ; unsigned __int64 call __Znam ; operator new[](ulong) mov cs:qword_36070, rax mov rdi, cs:qword_36070 ; char * mov rsi, [rbp+var_28] ; char * mov edx, [rbp+var_48] ; unsigned int call __Z6memcpyPcPKcj ; memcpy(char *,char const*,uint) jmp loc_CDFD