yasmine
Goodmorning, is anyone here want T-shirts or like with a specific design, finally, is available, you can now buy a T-shirt, iphone cock, labtop skin..... with the design you want, if you re interrested contact me..
Prince Fine
CaviarX
Himanshu
CaviarX
If you want faster,try Eluer ones
CaviarX
Is anyone in this group a OIer or a ACMer?
Ato
\Device\NUL
This is the third time you ask question in this group
\Device\NUL
I curious you asking about some assignment or test
\Device\NUL
Just see some dynamic memory allocation examples with C in google
\Device\NUL
I learn dynamic memory allocation in programiz.com
Andrii
Albin
Woah
Anonymous
Wth 😂
Roxifλsz 🇱🇹
/ban get out reeeee
TL
please anyone ? i need advice
TL
About Malloc in c programming
What is the correct statement to allocate a string of run-time variable size LEN?
1) char str = malloc(LEN);
2) char *str = malloc(LEN);
3) char *str = (char*)malloc(LEN);
4) char *str = (char*)malloc(LEN*sizeof(int));
5) int *str = (int*)malloc(LEN*sizeof(int));
Abhishek
1. Incorrect
2. corr
3. corr
4. corr
5. corr
Prince Of Persia
\Device\NUL
Prince Of Persia
Why not 5 ?
5 is not a string
It's a pointer to ints(array pointer)
\Device\NUL
Pavel
auto str = (char*)malloc(LEN);
That line alone raises some questions :)
Like, if it's C then why auto (will it be int in C?)
If it's C++ then why malloc
:D
\Device\NUL
Pavel
\Device\NUL
Prince Of Persia
Prince Of Persia
\Device\NUL
In g++😁
Well, auto is in Standard C++, you don't have to worry about compiler
Anonymous
%Nikita
Hi guys!
I am really confused about this line:
uint32_t val = *(uint32_t*)&a;
(a has another type, for example float)
I still don’t understand in which standards it can be work fine, because in my compiler (gcc) it gives me the value of 0, but a is 1.5.
Is it forbidden to cast pointers?
Anonymous
Sid Sun
In C++
std::cout<<"*"
In C
#include <stdio.h>
printf("*")
Anonymous
Sid Sun
Ah fuck! Forgive me, my C is a little rusty
Mostafa
Hi!
I have written a program. named Clocker! it calculates the useful spent time on your computer.
How it works?
it calculates your whole time on the system and considers your mouse and keyboard usage as useful time! and the end gets you a simple report of how much time you spent on the system and how much of it is useful time and waste time!.
well, I wrote it because of my self-usage. but if you feel it might be useful, try it!
(it's now on version 0.2-beta.7)
(I welcome any feedback!)
LINK TO GITHUB
Anonymous
https://man7.org/linux/man-pages/man2/bind.2.html
Abhishek
it was not an ad, was it, i pasted the telgram channel link which post job vacancies. Was that rule violation ? @admin ?
Sid Sun
Abhishek
yeah, i have gone through the rules, i am still not able to find which rule did i violate @Sid Sun
Sid Sun
Advertising
Sid Sun
Won't it violate posting links, as well?
klimi
Won't it violate posting links, as well?
depends on what link it is... if it is unrelated youtube video that was published within an hour with 1 view or if it is answer to some question where the youtube video explains the problem and solution...
G Tyagi...
Help finding me unique number from an array of n numbers, n taken from user..
Eg
Input
11
5 3 1 5 1 3 4 7 4 8 8
Output
7
(Because all elements except 7 aur occurring double)
G Tyagi...
Help finding me unique number from an array of n numbers, n taken from user..
Eg
Input
11
5 3 1 5 1 3 4 7 4 8 8
Output
7
(Because all elements except 7 aur occurring double)
Tell me where I am wrong
#include<iostream>
 using namespace std;
 int findunique(int arr[],int n)
 {
  int i=0;
  while(i<n)
  {
      bool found=false;
      int j=1;
      while(j<n)
      {
          if(i==j)
          {
              continue;
          }
          if(arr[i]==arr[j])
                  {
                      found=true;
                      break;
                  }
                  j++;
      }
      if(!found)
      {
          return arr[i];
      }
      i++;
  }
 }
int main()
 {
     int n;
     cin>>n;
     int arr[100];
     for(int i=0;i<n;i++)
     {
         cin>>arr[i];
     }
     findunique(arr,n);
}
Na me
Help me to Write a C program to implement the functionality of command “cat file1 file2 > file3” using
fork() system call. Where the file names are the input to your program. Your program should
check whether the given file names exist or not. If the file doesn’t exist, display the error
message and exit the program.
Sid Sun
G Tyagi...
Anonymous
Anonymous
In end you will available with unique number
Abhishek
scan the arrau and keep XORing all the elements of the array. The XOR result that you are left with is the answer.
Naina
M. Wahyu
C++ for AI or Python for AI 🤷♂
M. Wahyu
Anonymous
Anonymous
here you code :
#include<bits/stdc++.h>
using namespace std;
int findunique(int arr[], int n);
int main()
{
int n, b;
cout << "what is the dimension of array: " << endl;
cin >> n;
int arr[100];
for (int i = 0; i < n; i++)
{
cout << "[" << i + 1 << "]th element" << endl;
cin >> arr[i];
}
b = findunique(arr, n);
if (b < 0)
{
cout << "Number not found" << endl;
}
else
{
cout << "found :" << b << endl ;
}
return 0;
}
int findunique(int arr[], int n)
{
int i = 0;
while (i < n)
{
bool found = false;
int j = 0;
while (j < n)
{
if (arr[i] == arr[j])
{
found = true;
return arr[i];
break;
}
j++;
}
if (!found)
{
return -1;
}
i++;
}
return -1;
}
Anonymous
I hope you like it
\Device\NUL
Anonymous
'cause I like to use it
\Device\NUL
Lol
Anonymous
noice
\Device\NUL
https://www.quora.com/Is-it-good-practice-to-use-include-bits-stdc++-h-in-programming-contests-instead-of-listing-a-lot-of-includes
Anonymous
thanks
Alessandro
Guys exactly why cpp modules??
Talula
Alessandro
Its a new feature of the cop compiler, allows to produce a binary file out of cpp and or header files, that can be used during compilation. It should speed up the compilation time… i don’t understand how it’s different of supplying header and binary for a library or module
Strauss21
can getpid() return a negative value
Anonymous
Thank you 🤗🤗
Anonymous
Its a new feature of the cop compiler, allows to produce a binary file out of cpp and or header files, that can be used during compilation. It should speed up the compilation time… i don’t understand how it’s different of supplying header and binary for a library or module
Modules were not added to speed up compilation time. That is a side effect.
Their main advantage is that they get rid of problems with header files like independent compilation (modules are compiled independent of the source files that include them. This is very different from Precompiled header files which was a way to speed up compilation times for header files that are often included. This required the header files to be included in a specific order dependent on the implementation).
Macros and preprocessor directives in a module are explicitly prevented from being exported which means they have no effect on the source code that imports the module. Also source code which is not exported from a module will not affect the source file that is importing the module which speeds up compilation.
Also modules have the advantage of not impacting your code irrespective of the order in which they are imported. The rules for overloading are also simplified because the declarations in the source file do not affect the overload resolution process in the importing module.
All of these work together in speeding up the compilation process because modules can be compiled independently into a binary format that is similar to an AST generated by a parser in the compilation process and this AST can be processed much faster by the compiler during compilation of a translation unit which imports the module.
Anonymous
C++ for AI or Python for AI 🤷♂
Python anyday but I do use C++ when I work on data flow graphs or deep neural networks or on Unsupervised Learning which requires heavy GPU usage.
Alessandro
coal
coal
if you're, for example, implementing genetic algorithms
coal
the speed of a compiled language like C++ would be of huge advantage in running thousands of simulations