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
Himanshu
from 2 to sqrt(i)
Now I'll understand 😅
CaviarX
If you want faster,try Eluer ones
CaviarX
Is anyone in this group a OIer or a ACMer?
\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
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
Why not 5 ?
5 is not a string It's a pointer to ints(array pointer)
\Device\NUL
Prince Of Persia
Ah, you're right. Sorry my bad
There is nothing to be sorry about
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
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
Does auto without asterisk will declared into pointer automatically or just normal variable ?
Pavel
Does auto without asterisk will declared into pointer automatically or just normal variable ?
In C++ the type will be deduced to be a pointer (char*) in this case.
Prince Of Persia
\Device\NUL
In g++😁
Well, auto is in Standard C++, you don't have to worry about compiler
%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?
%Nikita
It's not forbidden but you should use it only when you want to work with bits. https://stackoverflow.com/questions/15578935/proper-way-of-casting-pointer-types
Thank you for feedback anyway, but as C programmer I don’t understand constructions like reinterpret_cast<BYTE*>. I can only think about what it does. And I already familiar with casting from void* :) I mean cast from one type (int, char, double, float) to other type. Maybe I have to search better
Sid Sun
In C++ std::cout<<"*" In C #include <stdio.h> printf("*")
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 ?
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
klimi
it was not an ad, was it, i pasted the telgram channel link which post job vacancies. Was that rule violation ? @admin ?
Firstly it seems you haven't read the rules... * Spamming/advertising (job posts are also ads, so ask an admin before posting) will grant you a warning or an immediate ban if you do it right after joining. Secondly... really a job posts? then why is the last one crypto campaign ad? *****is one of the fastest-growing cryptocurrency exchanges, with more than 3 million registered users. Come and join us!!
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.
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
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); }
I think i found the error , In the 9th line of ur code , I.e int j=1 The problem with this statement is Everytime the value of j is set to 1 , in every successive loop , it should always exceed i by 1 So it should be j = i + 1 ; instead
M. Wahyu
C++ for AI or Python for AI 🤷‍♂
Talula
C++ for AI or Python for AI 🤷‍♂
Whatever you are comfortable with.
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
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??
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
klimi
can getpid() return a negative value
RETURN VALUE The getpid() function shall always be successful and no return value is reserved to indicate an error.
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
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.
From what you wrote, the only advantage is order of inclusions of module does not matter… this means that if a module has a dependency, that dependency can be imported after the module is imported? However this is really solving a problem that should not happened in the first place (my opinion)
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