Anonymous
I think you got the idea
Vishal
#include<stdio.h> Int main() { If("abc") { Printf("hello"); } return 0; }
Anonymous
I need some help about a c program
Anonymous
What is the usage of "Break" statement here and how 6 came on the output? #include <stdio.h> main() { int i, j, x = 0; for (i = 0; i < 5; ++i) for (j = 0; j < i; ++j) { x += (i + j - 1); printf("%d\n", x); break; } printf("\nx = %d\n", x); } Output on compiler: 0 1 3 6 x = 6 Press any key to continue . . .
Anonymous
and i and j are increasing at every second till the condition becomes false
Anonymous
and break is doing nothing there
klimi
?
Harun
I want to use time functions in the c programming language, but the time function is from 1970 and I can't see the result exactly. Is there a way to reset it?
J
and break is doing nothing there
In the snippet you provided, break is making sure that j = 0. I think the second for loop is unnecessary
Anonymous
Fuck you
Anonymous
www. YouTube. Com
Dima
lol
Anonymous
Someone know inf resources of QT API for game dev?
DarkEnergy
/get cppbookguide
\Device\NUL
gets() IS VERY DANGEROUS and should never be used (unless you want experiment with buffer overflow) According to Linux Programmer's Manual gets() will return char * from passed argument to the function on success (which is always true if you put in on condition) or NULL on error or when EOF occurs while no char have been read Never use gets() because you can never limit how many characters it will read THERE ARE NO GUARANTEES THAT THE FUNCTION WILL EVEN RETURN ISO C11 removes the specification of gets() Just use fgets() or scanf() with maximum field width
Anonymous
Ok
YW
Okay
Unknown
(aVb)*abb(aVb)*.   Can any one explain this to me, what is V when I draw the dfa
J
Second for loop is working
No, it works in this fashion 1.Initialize x,i,j with 0 2.Loop 1: i=0 3.Loop2: j=0 Mismatch 4. Increment 5.Loop1:i=1 6. Loop2: j= 0 7: x = 0 8.break 5.Loop1:i=2 6. Loop2: j= 0 7: x = 1 8.break And so on. Or in general, j stays 0
J
So, second for loop is unnecessary in your snippet since if can do the same thing
Anonymous
break can only be part of code if the condition is becomes false
Anonymous
dm me for more
Anonymous
oops
Anonymous
break is working there at second loop
J
break can only be part of code if the condition is becomes false
No, breaks are used if you want to terminate a loop. So, it can even make a for loop work like a if statement and I think for loops use zero cost in C like C++. Or simply, in your case, it acts like a if statement I can do if(j != i) { x += (i+j) - 1; }
Anonymous
#include <stdio.h> int main() { int i, j, x = 0; for (i = 0; i < 5; ++i) for (j = 0; j < i; ++j) { x += (i + j - 1); printf("%d\n", x); break; // here the break stops the second loop for every first for loop } printf("\nx = %d\n", x); }
J
Or, if(i!=0){ x+= i-1; } And it produces the same output
Anonymous
#include <stdio.h> int main() { int i, j, x = 0; for (i = 0; i < 5; ++i) { // for (j = 0; j < i; ++j) // { // x += (i + j - 1); printf("%d\n", x); // break; // } if (i != 0) { x += i - 1; } } printf("\nx = %d\n", x); } output 0 0 0 1 3 x = 6
Anonymous
#include <stdio.h> int main() { int i, j, x = 0; for (i = 0; i < 5; ++i) for (j = 0; j < i; ++j) { x += (i + j - 1); printf("%d\n", x); break; } printf("\nx = %d\n", x); } output 0 1 3 6 x = 6
Anonymous
x = 0 x = 0 x = 1 x = 3 x = 6 still this
J
x = 0 x = 0 x = 1 x = 3 x = 6 still this
#include <stdio.h> int main() { int i, x = 0; for (i = 0; i < 5; ++i) if(i!=0) { x += i - 1; printf("%d\n", x); } printf("\nx = %d\n", x); } output 0 1 3 6 x = 6
J
The first printf just prints values and second print gives x = final result
Anonymous
yup!
Anonymous
/get DsaBook
Anonymous
Somone can suggest me from where i start learning dsa
DEV 7
2. Write an algorithm to delete a data key from a Threaded binary tree.
Talula
Somone can suggest me from where i start learning dsa
If you mean Data Structures and Algorithm... try this https://www.cs.bham.ac.uk/~jxb/DSA/dsa.pdf
tkali
Could you please any one can share me codeblocks for windows 10 64 bit🙏
Siddhartha
Anonymous
https://sourceforge.net/projects/codeblocks/files/Binaries/20.03/Windows/codeblocks-20.03-setup.exe/download
Anonymous
yes
Anonymous
Can we make our community separate for different language?
Anonymous
with own bots??
Anonymous
Like in all the leading language in the world
Luca
Guys, is there some simple way to know the OS that is running my code? I'm making a linux program, but i should change few actions depending by the distribution (Raspberry pi OS or Ubuntu/Mint in my case)
Arnold
Lol @noname152021 do you expect us to do your homework?
Sarfaraz Stark
Does anyone know how to print palindrome pyramid with user input ?
100$ website
Does anyone know how to print palindrome pyramid with user input ?
simple snippet YT palindrome pyramid with user input
Abhishek
any Advance level C++ programmer here. Need help pls.
Talula
any Advance level C++ programmer here. Need help pls.
Ask the question, if there is someone who can solve it, they would answer.
Samir
Hi, I am looking if anyone has some good sources like books for learning C++ from A to Z?
Samir
I am a beginner in c++, and in desperate need of sources. That is why.
Samir
If anyone can help, please let me knwo
Samir
Know*
Pavel
Hi, I am looking if anyone has some good sources like books for learning C++ from A to Z?
There is no A to Z in C++, it's a bit more complex than that, but there are books:
Talula
I am a beginner in c++, and in desperate need of sources. That is why.
You didn't understand the question, why do you need to learn C++, are you a programmer that wants to expand into C++, you are a student or are you into embedded system development?
Talula
I am a school student. But am really interested in learning programming languages
Ah, okay... but why don't you start with watching YouTube videos?
Anonymous
//*How 14 and 20 came on the output can anyone explain?* #include <stdio.h> main() { int i, j, k, x = 0; for (i = 0; i < 5; ++i) { for (j = 0; j < i; ++j) { k = (i + j - 1); if (k % 2 == 0) x += k; else if (k % 3 == 0) x += k - 2; printf("%d\n", x); } } printf("\nx = %d", x); } /*output: 0 0 2 4 5 9 10 14 14 20 x = 20Press any key to continue . . */
I use Arch
MB? What?
Maybe Internet megabytes