Anonymous
valgrind results
Anonymous
@Neko_cpp it sorta works lol
Anonymous
i think valgrind showing me where the issue is
Anonymous
something to do with the comparator function i wrote for qsort
Anonymous
Hello
Anonymous
if you're still having problems with this I can help you debug if you post the program
Anonymous
Michael
Anonymous
01000001011011010100000101101110
Gregory
think you only have C compiler here not C++
01000001011011010100000101101110
think you only have C compiler here not C++
This isn't compatible with new standards of cpp
Like
Use of iostream instead of iostream.h
Here we also don't need
using namespace std
Gregory
RiyAz
Write a c program to reverse linear linked list.
klimi
No
RiyAz
Sample input -10 20 30 40 50
Sample output - 50 40 30 20 10
klimi
As I said.... No
klimi
Do it yourself dude
RiyAz
I tried
klimi
And failed. Thats okay, try again
Dan
I_Interface
klimi
I_Interface
Sure
Ow, it is a second ask to do his job...
klimi
Ahmed
What's SBS alogrithem any idea ? No any info on Google
Gregory
Hi there!
https://app.codility.com/demo/results/trainingX3Q4RK-KES/
How do you think is it issue of the rest 20% is that there is not enough capacity in container? If so, how to solve? This.
Dima
Gregory
Dima
klimi
@Neko_cpp
Francesco
Hello I have a problem
Dima
Francesco
(C language) I must create two processes that print their PID and PPID
Dima
so what’s the hitch?
Francesco
And i have to use the system call waitpid for one of them
Francesco
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main() {
pid_t pid, child_pid;
int exit_code, stat_val, i;
printf("Fork program starting.\n");
for (i = 0; i < 2; i++) {
pid = fork();
switch (pid) {
case -1:
perror("Fork failed.\n");
exit(1);
case 0:
exit_code = 4;
printf("This is the child. PID=%d, PPID=%d.\n", getpid(), getppid());
sleep(1);
break;
default:
exit_code = 0;
break;
}
}
//metto il padre in attesa del primo processo figlio creato
if (pid) {
child_pid = waitpid(pid, &stat_val, 0);
printf("Child has finished. PID=%d.\n", child_pid);
if(WIFEXITED(stat_val))
printf("Child exited with code %d.\n", WEXITSTATUS(stat_val));
else
printf("Child terminated abnormally.\n");
}
exit(exit_code);
}
Francesco
This my code, but the fork creates 3 and not 2 children
Francesco
And I don't know how can I choice the child that I want for the waitpid
Francesco
Can you help me?
Anonymous
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main() {
pid_t pid, child_pid;
int exit_code, stat_val, i;
printf("Fork program starting.\n");
for (i = 0; i < 2; i++) {
pid = fork();
switch (pid) {
case -1:
perror("Fork failed.\n");
exit(1);
case 0:
exit_code = 4;
printf("This is the child. PID=%d, PPID=%d.\n", getpid(), getppid());
sleep(1);
break;
default:
exit_code = 0;
break;
}
}
//metto il padre in attesa del primo processo figlio creato
if (pid) {
child_pid = waitpid(pid, &stat_val, 0);
printf("Child has finished. PID=%d.\n", child_pid);
if(WIFEXITED(stat_val))
printf("Child exited with code %d.\n", WEXITSTATUS(stat_val));
else
printf("Child terminated abnormally.\n");
}
exit(exit_code);
}
the parent forks on i = 0, and on i = 1 the parent and the first child also forks, just exit the for loop in the case 0
Anonymous
Sher
Hey check this tool out
Sher
https://www.sourcetrail.com/blog/open_source/
Sher
It's great for c++ programmers
Sher
For very long code
Sher
And its free and open source now
Sher
I'm testing it myself now
Francesco
Francesco
And I can use an array for the choice of PID in the waitpid?
Ludovic 'Archivist'
Ludovic 'Archivist'
In short, one of many algorithms to eagerly recognize patterns
Sher
I am not sure, as I said before I am trying out for the first time, before it was paid and closed source, recently it became free and open source
Sher
Its good works well and organises in a easy to understand, even mention namespaces used. I tried with simple GUI calculator randomly downloaded from github.
Sher
Also looks for external header files in source with auto detection feature
Sher
I may try large file next time and give you the results soon
Sher
or later
Sher
This program is also available for 32 bit based PC also Linux
Sher
Bye for Now
Mathur
Guys may i know how to get
Mathur
Input frm user
Mathur
Which is mix of char and int
Mathur
What data type should i use to declare the variable?
Dima
parse it
Pavel
Mathur
For c
Ludovic 'Archivist'
Mathur
Wht data type i should initialize here?
Printf("Enter studentd id :")
Scanf( ????)
I need to get the student id which is like M1055682
Ludovic 'Archivist'
Giri
Mathur
Im actually new to programming
Mathur
So i have no idea about parser or array i will search and learn it and them i will come back to you guys for futher doubts