Chika
Done same problem
Anonymous
I use dirent.h header file in C .today I tried to use it in C++ i'm getting an error stating no such file. Can anyone help?
Anupam2.7
in c++ if there is a condition like this if (0<x<10){ cout<<"true";} Then what does this condition is checking. Is it marks is greater than 25 and less than 45 or it means? marks is greater than 25 or less than 45 According to me it should follow the and one but when i run the program give x a number more than 45 it prints true
christian
What does it mean when the Betty linter throws a warning that says no description found for function main?
Pavel
in c++ if there is a condition like this if (0<x<10){ cout<<"true";} Then what does this condition is checking. Is it marks is greater than 25 and less than 45 or it means? marks is greater than 25 or less than 45 According to me it should follow the and one but when i run the program give x a number more than 45 it prints true
I'm not sure but I would guess it compares 0 and x, and if x is greater than 0 it compares 1 (bool converted to int) with 10, so if 1 less than 10 then the condition is true. If x is not greater than 0, then it compares 0 with 10. So it's something like this in the end if ((0 < x) < 10) So the condition will always return true
christian
Out
Dm
What does it mean when the Betty linter throws a warning that says no description found for function main?
https://stackoverflow.com/questions/72505202/warning-no-description-found-for-function-main
Anonymous
🤔 but any other CPU thing could be happening between the kernel and the cudaMemcpy?
I don't see any other instructions between the sumCommMultiBlock and cudaMemcpy. So why would the CPU do anything else as far as this process is concerned? The cudaMemcpy is a blocking call at the CPU which will wait first for all the kernels to finish and then copies the memory. The CPU can continue execution only after the memory copying finishes. So there is no need for synchronisation here. cudaDeviceSynchronize is useful when you have multiple cudaStreams running and you need to share data between them. It may be useful for debugging if your kernel prints logs which won't happen unless you synchronize. Outside of these use cases, you don't need to call cudaDeviceSynchronize.
Michel
No, there is not any other instructions in the example, but my second question was about "what if there were..."
christian
https://stackoverflow.com/questions/72505202/warning-no-description-found-for-function-main
I had checked this out, it had not helped. but I found the official docs for betty, which I could not find in the first place. Thanks a bunch anyway
Anonymous
No, there is not any other instructions in the example, but my second question was about "what if there were..."
That depends on what the intermediate instructions are. Are all the kernel tasks in the same cudaStream or different streams? If they are in the same stream, the kernel tasks will be automatically synchronized. This is why I said in my previous post that you need cudaDeviceSynchronize only when you use multiple cudaStreams
Bohdan
Good evening, i have a problem with building of the code, it takes about 10 seconds. Could there be a problem with RAM? (i have 16 gb) ?
Dima
ram speed and core count
Dima
io/ssd speed
Anonymous
I had the same issue too but 4 me i found out it was firewall scanning my executable file b4 running, so i exclude the folder from virus scans, and it was fast again
Bohdan
io/ssd speed
thank you
Vams
Can anyone complete this project
Vams
I have a project related to nodes and edges . Can anyone help me with that Dm me for files
Anupam2.7
int sum,n; cout<<sum<<endl; cin>>n; return 0; This program is giving random outputs for line 2 but if i comment out line3 it is working fine(giving output 0) WHY? The values it is returning is 32765/32766/32767
松鼠
int sum,n; cout<<sum<<endl; cin>>n; return 0; This program is giving random outputs for line 2 but if i comment out line3 it is working fine(giving output 0) WHY? The values it is returning is 32765/32766/32767
It's depend on where the variable located. Because you didn't assign a value to sum, value of sum remain the value which on the place allocated to sum.
Someone
XD
hello
is this a valid statement?
hello
c = ((c + 10) % 122) + 96;
줄리아 우지야노바
VīrūSīlvēstēR
hello
i have a program that every time i input the same thing it outputs different answers
hello
https://pastebin.pl/view/6310af07
hello
every time i input any 10 letters before z it outputs a different output
Anonymous
wow and do you have a source code in c++?
𝟶𝚡𝟻𝟿
Wha'ts scanf?
novice
nothing , by mistake
Void
#include <stdio.h> int main(){ int grades;//(60-100) scanf("%d",grades); switch(grades/10){ case 10: case 9:printf("%d belongs to A"); break; case 8: case 7: case 6:printf("%d belongs to B"); break; case 5: case 4: case 3: case 2: case 1: case 0:printf("%d belongs to C"); return 0; } }
Void
Can someone help me see what is wrong with my code? :(
Thadeu
your printf are missing the 2nd argument to fill %d
klimi
Well if you asking for a code review for your c++ code, it seems reasonable. So you can do that
Pavel
Hi again, I have been having trouble setting up visual studio, is there an alternative software I can make use of
There are QtCreator, CLion, Visual Studio Code, but some of them may be a bit more difficult to setup
David
What do you mean?
I mean, for example if you will use your variable in the future eg in a for loop. Since the variable will be really involved and you won’t want it’s address value to temper with your evaluations. So better assign it a value.
Dm
What do you mean?
just keep in mind that if you declare variable without assignment it can store garbage (previous memory state). Assignment operations costs computation time so in C/C++ usually you won't pay for something which you don't use explicitly.
.
Can anyone suggest me which online compiler will be best for practicing C?
Dm
Onlinegdb its not complex as godbolt
God bolt has simple interface and lots possible ways to get more information and make it more complex.
▪️fateme👷🏻‍♀️
#include<stdio.h> struct node { int data; struct node* next;   struct node* prev; }; int main() { struct node* ptr1=(struct node*)malloc(sizeof(struct node)); struct node* ptr2=(struct node*)malloc(sizeof(struct node)); struct node* ptr3=(struct node*)malloc(sizeof(struct node)); ptr1->data=10; ptr2->data=20; ptr3->data=30; ptr1->next=ptr2; ptr2->next=ptr3; ptr3->next=NULL;   ptr3->prev=ptr2; struct node* ptr=ptr1; while(ptr!=NULL) { printf("%d\t",ptr->data); ptr=ptr->next; if(ptr==ptr3) { ptr=ptr->prev; } } } The output of this code is: 10 20 20 20 20 20... But I wanted to change my code so as to have this as output: 10 20 20 30 but I don't know how I can!!! and I don't want just to type what I want using printf, cause I'd rather using loop
Anonymous
So is it a good practice to assign a value to variable as soon as I create it?
On the contrary, it is a good practice to create new variables close to the place where you need them. That way you will know what a good initial value is.
Kaashᅠ
Can any elaborate , why string is not highlighted like other data types , in any IDE or Text Editor?
Divyanshi
Hey! Can anyone tell how to print all prime nos till n Pls tell the most short and precise code!
Anonymous
c = ((c + 10) % 122) + 96;
Depends on the type of c. If c is a signed char and a char is 8 bits long, then this can overflow and result in Undefined Behavior
Divyanshi
Is their any other method as well?
Dima
smells like a ban
Fonzi
a bit off topic but is there any good resource for learning assembly?
adnanhossainme
Suggest some with pdf
Divyanshi
Darkfire
https://dpaste.org/VMS28
You have written for the number of prime numbers under the range, nd moreover you can optimise it by j<=i/2
Max
#paste
Max
https://pastebin.com/GvTZ4y3B Please help to make import of sdk functions of game to my functions file
SerFed
Hi everybody. I have question about WinApi. I have WM_DRAWITEM for draw stylized button. But button become to white quad if I create it inside Static. How I can fix it?
adnanhossainme
Use this "[^\n]" to take input and make a loop to char count untill null Character \0