Artöm
Function declaration looks like
ret name(args);
You dont have ret piece in your code
Artöm
If these lines are calling functions, as I said its forbidden to call functions without declaring anything in global scope
PO
Artöm
Inside main or inside other functions
PO
I have 4k.h in which I give all the prototype
PO
PO
I declared all of them inside my 4k.h
Artöm
Show main code
PO
Artöm
Whats pF? It is not declared anywhere
Artöm
Other errors are same
klimi
No it does not
Its shown in the guide (when I lastly installed gentoo)
Anonymous
klimi
PO
Anonymous
int a[4] = {1,2,3,4};
int b[4] = {1,2,3,4};
int n = &b[3] - &a[2];
Value of n is 5. Any logic behind this, or does it vary between compilers?
Anonymous
Anonymous
Artöm
Artöm
And yes it may vary
Anonymous
Dev
I'm just going to start c can anyone tell me how to do it
Abd_jack
Any code
Abinaya
Done🙂
Anonymous
Hello, does anyone know a site where I magician types of different tasks with c ++ and their solution
Tokin
What do you mean?
Tokin
Oh quests based learning or some stuff?
Nothing
Hey everyone, can anyone tell me why is the output of this code is not the same every time?
i know that the fork will create a child process but i couldn't understand the output!
Alex
check your OS if order of child/parent process execution is specified after fork
Alex
show your different output
Alex
I know the possible reason: you have several processes, so OS can decide which process to run "randomly"
Alex
but you have small program, so it should be the case every time, if OS is not heavy loaded
Alex
you have not checked :
int i = 1;
printf("i = %d\n", i);
fork();
Alex
so after this fork both child and parent process creates new child
Alex
thus, order of execution is not specified
Nothing
ah okay thanks for the help👍🏻
Anonymous
I have such a task, but I do not know which algorithm I need to use here,who can help
Anonymous
Write a program that gets a natural number N (N ≤ 1000) at the input, then a sequence of N characters. As a result, the program must display the digits of the sequence and then the remaining characters. The displayed characters must be separated by a space. Use array to solve the problem.
Anonymous
#include <iostream>
int main() {
int N;
std::cin >> N;
int arr[1000];
for( int i = 0; i < N; i++){
std::cin >> arr[i];
}
Anunay
Anunay
Use your brain
Anonymous
I'm trying and just starting to learn
Anonymous
Anonymous
Iam trying to understand myself from a weak but I need some help,please
Anonymous
Anonymous
I can't understand " if(digitseen[digit]) " what is it mean
LK
Array subscripts always start at zero... so the elements are digitseen[0], digitseen[1].. digitseen[9].
LK
Lets take example: 12341
digitseen [10] is false.. means from 0 to 9 is false.
12341%10 = 1(digit)
Now if condition is false, cz you have declared digitseen[10] is false..
Now digitseen[1] is true... this means digitseen[0] is false digitseen[1] is true and others are false...
12341/10 = 1234
Again loop starts with 1234
1234%10 = 4(digit)
Again if condition is false cz, digitseen[4] is false
So digitseen[4] becomes true
1234/10 = 123
Repeats till 1 comes...
While checking condition for element 1...
If digitseen[1] is already true so it breaks..
LK
Now you understand?
Anonymous
anyone can you check it?
Anonymous
#include <iostream>
int main() {
int N;
std::cin >> N;
int arr[1000];
for( int i = 0; i < N; i++){
std::cin >> arr[i];
}
for (int i = 0; i < 1000-1; ++i) {
std::cout << N << " ";
}
}
Anonymous
i guess that's wrong
Anonymous
Write a program that gets a natural number N (N ≤ 1000) at the input, then a sequence of N characters. As a result, the program must display the digits of the sequence and then the remaining characters. The displayed characters must be separated by a space. Use array to solve the problem.
Indolent
transform(sample.begin(), sample.end(), sample.begin(), [](char c) -> char{return c == 'y' ? 'x' : 'y';});
Indolent
What is happening in the last parameter?
Indolent
"[](char c) -> char{}
Indolent
What is the meaning of this expression?
piggyho
Indolent
accumulate(something.begin(), something.end(), string("")) What is the string("") parameter doing?
piggyho
piggyho
"[](char c) -> char{}
lambda function
captures nothing
takes one character parameter
is expected to return a character but does not have a return statement in it, thus error
there's nothing in the back does nothing
Anonymous
Artöm
Artöm
On line 52 there should be sizeof(char*)
Artöm
Line 85 leaks memory btw
Artöm
Look at 85
Artöm
It frees end of pointer array, but does not free memory pointed to by them
Artöm
You leak some of what you calloced at 55
Artöm
Yes
Artöm
Use debugger, track pointer values
Serenity
Why does returning a pointer to a local variable yield undefined behavior ?
Anonymous
Serenity
from a function
Anonymous
Using the pointer is UB