Ronak 🇮🇳
what is volatile keyword for ?
And what's the use of it?
Mar!o
#googleit
Anonymous
Can anyone suggest me best website to learn c programming
Dima
Anonymous
Atleast can anyone suggest one of the website
Anonymous
Tqq so much
Leila
Hello guys!
I can teach you competitive programming in c++. Algorithms and data structures are included. If you are looking for teachers, dm me!
Renan
What is the easiest way to learn C/C++: Official documentation or private/third party books? 🤔
Dima
There’s no easy way
Artöm
Anonymous
Renan
Then how people learned it when no books existed? 🤔
Books help a lot, obviously. But there must be information to know the thing.
Dima
its called google
Anonymous
Renan
its called google
If your neighbor is nearer than google, then why waste time searching for something he already has? Wouldn't it be faster?! 🤔
Renan
People who wrote the first books must have acquired knowledge somewhere.
Dima
Selim
Thanks Madhu :)
Anonymous
Just reply to a message to purge from
Anonymous
Yep, that's the downside
Anonymous
So we need do it by hand
.
Edward
I am trying to compile and run a simple hello world c++ code . G++ says no input files
G++ fatal error: no input files
Compilation terminated
How to solve the problem?
Edward
#include<iostream>
using namespace std;
int main()
{
  cout<<"Hello World";
  return 0;
}
Michele
the command, this is the code
Michele
if your program name is hello_word.cpp you simply compile like g++ hello.cpp
Michele
😂
Anonymous
Thank you
Serenity
Does anybody have any idea to implement recursion with digital circuts ?
Serenity
Meaning logical gates
MᏫᎻᎯᎷᎷᎬᎠ
Meaning logical gates
Yeah
Define a '||' or '&&' to your type and make a recursion call inside your function lool
Serenity
I am sorry I asked in the wrong group. I meant to send it somewhere else.
Dima
Serenity
My question is not directly related to programming languages.
Anonymous
Hello Rose, I know my question may seem out of bounds. But you are a bot and I am wondering how you make decisions. Are requests or events forwarded to a real person who manages them or you are just an incredible bot that can somewhat superficially think or maybe another thing. I don't even know whether you understand me as I don't understand how you work.
Dima
lmao
Dima
I hope this is a pure sarcasm
Anonymous
Nope, just new to this whole thing with bots.
Edward
Anonymous
Who’s got good gateway?
Anonymous
#include <stdio.h>
int main (){
printf("hello everyone! I'm new here");
return 0;
}
Dima
Anonymous
Sasuke
Hi there is a problem I was trying to solve
Problem- https://www.hackerrank.com/challenges/dynamic-array-in-c/problem
And attaching the solution in the below screenshot
Sasuke
Sasuke
So I understood the whole code except the few lines under
If(total_number_of_pages[X] ==1)
Why we are using malloc here and relloc after the else statement here?
As in the code we already dynamically allocated memory to total_number_of_pages ?
Ammar
#ASK
Hi everyone, how can I avoid mangling name of C++ global variable?
Consider this code, line 58
https://gist.github.com/ammarfaizi2/5c806c155c12f4b6d27922080c69d16b#file-web-compiled-cpp-L58
The variable const zend_function_entry GTPHP_HASH_GreenTea_Routes_methods[] has already been in extern "C".
Ammar
But when I compiled it, it became _ZL34GTPHP_HASH_GreenTea_Routes_methods.
How can I remove the _ZL34 here?
Ammar
This makes my library that is linked to that object getting this error
/home/ammarfaizi2/project/now/GreenTeaPHP/modules/greentea.so: undefined symbol: GTPHP_HASH_GreenTea_Routes_methods
Ammar
I understood and I did wrap them, but it is still resulting the mangling name on my variable. I am still looking for where is the missing part here.
Ammar
I did
Ammar
https://gist.github.com/ammarfaizi2/5c806c155c12f4b6d27922080c69d16b#file-web-compiled-cpp-L58
Ammar
Do I need to share my compile command?
Give me a minute.
Ammar
/usr/bin/g++ -Wall -I. -I/home/ammarfaizi2/project/now/GreenTeaPHP/build/greentea_php/routes -DPHP_ATOM_INC -I/home/ammarfaizi2/project/now/GreenTeaPHP/build/greentea_php/include -I/home/ammarfaizi2/project/now/GreenTeaPHP/build/greentea_php/main -I/home/ammarfaizi2/project/now/GreenTeaPHP/build/greentea_php -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/home/ammarfaizi2/project/now/GreenTeaPHP/src/greentea_php -I/home/ammarfaizi2/project/now/GreenTeaPHP/src/greentea_php/include -DHAVE_CONFIG_H -g -O0 -c /home/ammarfaizi2/project/now/GreenTeaPHP/build/greentea_php/routes/web.compiled.php.cpp -fPIC -DPIC -o routes/.libs/web.o -lpthread
Ammar
Nothing special with zend_function_entry. The zend framework itself is supposed to be written in C, not C++. I have been working with it in C for a long time, but today I want to extend my extension with C++.
Ammar
This is the zend_function_entry definition.
http://www.phpinternalsbook.com/php7/extensions_design/php_functions.html
Ammar
Thanks for your time.
Anonymous
Who can solve the following problem usin C language
Anonymous
A monkey picks some peaches, eats half of them and eats one more on the first day, and then eats half of the remaining peaches plus one on the next day, every day until the tenth morning The monkey found that there was only one peach left. How many peaches did the monkey pick on the first day? Output: a, b, c, d ....., sum Respectively: the number of peaches before eating peaches on the ninth morning, the number of peaches before eating peaches on the eighth morning, ..., the number of peaches before eating peaches on the first morning, total peach.
Sasuke
Thankyou thats what I was looking for
Sasuke
Which means if an array is of N dimension I have to allocate memory N times?
Sasuke
Thanks again
Ammar
Hey, I figured it out. Wrapping variable with extern "C" block {} does not remove the mangling name. I have to use extern "C" as prefix on my variable declaration.
This doesn't work
extern "C" {
const zend_function_entry GTPHP_HASH_GreenTea_Routes_methods[] = {
...
};
}
This works perfectly.
extern "C" const zend_function_entry GTPHP_HASH_GreenTea_Routes_methods[] = {
...
};
Ammar
Ammar
That was my understanding, but that's wrong.
Ammar
This one still has mangling.
Ammar
But this, doesn't have.
Ammar
Yeah, it works too.
Ammar
Ammar
So what is the conclusion here?
Ammar
So these are the recap of the above problem:
1. extern "C" {...} block doesn't work for variables, only works for functions.
2. We have to specify every variable definition whether a variable is external linkage or not.
Ammar
It is a little bit complicated for me.
Let me give an example to ask more detail
Suppose, I have qwe.so and asd.so, they both are written in C++.
qwe.so has extern "C" { int var_a = 1; }
asd.so has extern int var_a;
and they both are linked.
If asd.so reads the value of var_a, then we can say that var_a in asd.so is reffered to other translation units?
Ammar
Oh I see, I understand now.
Ammar
This works, but gives a warning.
Ammar
Ammar
Ammar
Yeah, thanks for the explanation.
vlad
Hey all!
I wanted to make some FREE Webinar and talk about the "Basics of Programming" in Python or C (whatever you prefer).
Let me know if you're interested! 🙋♂️🙋♀️
Anonymous