Anonymous
I think you got the idea
Vishal
#include<stdio.h>
Int main()
{
If("abc")
{
Printf("hello");
}
return 0;
}
Anonymous
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
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?
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
Anonymous
Anonymous
Anonymous
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
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
J
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
Anonymous
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
Nitin
I use Arch
tkali
Could you please any one can share me codeblocks for windows 10
64 bit🙏
Siddhartha
Anonymous
Anonymous
https://sourceforge.net/projects/codeblocks/files/Binaries/20.03/Windows/codeblocks-20.03-setup.exe/download
tkali
tkali
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
Anonymous
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
Abhishek
any Advance level C++ programmer here. Need help pls.
Samir
Hi, I am looking if anyone has some good sources like books for learning C++ from A to Z?
Talula
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
Samir
Talula
Samir
Anonymous
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 . .
*/
Talula
I use Arch
MB? What?
Maybe Internet megabytes
I use Arch