Amaregouda
Yes that's the expected behavior
but static variables initialzes only once means!!!?
Emre Atakuru
İf you dont want to modify variables you should use const specifier
Amaregouda
Copy paste
ok wait
Emre Atakuru
Only once means when you call the function all the variables initalize for every call and inside the function variables initilaze null but static variables doesnt initilaze again so every time call the function static variables same to first declare if you declare 10 its same when you call function again that provided by static
Anonymous
but static variables initialzes only once means!!!?
You're not reinitializing it, you're just changing its value. The statement still holds. Reinitialization would mean something like { int x = 10; } { int x = 5; } The name is same, but the two are completely different in different scopes.
Rifa
ok wait
I updated my answr
Amaregouda
Rifa
thanks bro
Haha my bad making u confuse at the first. Your Welcome
Amaregouda
what is the purpose of static variables in c
Ludovic 'Archivist'
what is the purpose of static variables in c
Sharing a memory space with each call without polluting the only namespace
Amaregouda
difference between diclare and initialze of variable??
Dark_🗿_
Anonymous
Code: #define MAXCURRENCIES 32 var CStren[MAXCURRENCIES],CStrenSum[MAXCURRENCIES]; int CNum[MAXCURRENCIES]; char CNames[MAXCURRENCIES*4]; int NumCurrencies = 0; Regarding CNames, the size of the array is 32 * 4 = 128. Does this mean that CNames can hold 128 elements?
B;
Y'all making some new programming language here
Anupam2.7
How to typecast string to integers in c++? i have already tried stoi() which is giving error and to_string() which is not giving desired output. string n; cout<<"Enter your number: "; cin>>n; int sum=0; int lenn=n.size(); for (int i=0;i<lenn;i++){ cout<<to_string(n[i])<<", "<<stoi(n[i])<<endl; }
Pavel
How evil would it be (if it's even possible), if a function that returns a tuple would return a value when the tuple would have only one element? Like this auto [a, b] = getVals<A, B>(); A* a = getVals<A>();
Anupam2.7
Try n[i]-'0'
only cout<<n[i]-"0" ???
Tazin
#include<iostream> using namespace std; int main(){ int a=33, b=76; if (a=b) { cout<<"Your value is "<<(a+b)<<endl; } else{ cout<<"Shuuuu"; } return 0; }
Tazin
No error is showing here bt why is it printing 152?
Anonymous
Create a function that converts a c++ string to cstring ,and use atoi() function. This function is in stdlib.h header file ,it converts cstring to integer
#include<iostream> #include<stdlib.h> int my_stoi(std::string &mystring){ char*p= new char[mystring.length()+1]; for(int i=0;i<=mystring.length();i++) p[i]=mystring[i]; return atoi(p); } int main(){ std::string name="10"; std::cout<<10+my_stoi(name)<<std::endl; return 0; }
Anonymous
Thanku
Cheers mate
ngdream
currently working on a program that will help you not to repeat the same piece of code in html, the program is made in c++ with bison and flex do you have any recommendations
ngdream
take a look here :https://github.com/ngdream/H5assembler
Captain
only cout<<n[i]-"0" ???
Single quote, n[i]-'0'
모하마드
I need reccomendation from you guys now currently i want to learn how to making game's cheat program with integration of ASM Which one from the both c and C++ Is the most preferably for building game's cheat program with integration of ASM? Thanks🙏🏻
Ludovic 'Archivist'
I need reccomendation from you guys now currently i want to learn how to making game's cheat program with integration of ASM Which one from the both c and C++ Is the most preferably for building game's cheat program with integration of ASM? Thanks🙏🏻
Both use the exact same integration of asm. I do not recommend to start with C unless you are the kind of person that takes Adderall and then proceed to count the rice grains left in the bag If you have little to none experience of programming, grab "Programming: Principles and Practice using C++" by Bjarne Stroustrup and start from there
Dev.🐍
Hi👋 I need help! I'm gonna work with obfuscate in my file, But I don't know how it works! Can someone help me?
Stay Forward
/getcbook
모하마드
Both use the exact same integration of asm. I do not recommend to start with C unless you are the kind of person that takes Adderall and then proceed to count the rice grains left in the bag If you have little to none experience of programming, grab "Programming: Principles and Practice using C++" by Bjarne Stroustrup and start from there
I'm experienced in intermediate level of programming any language such a php, javascript, python, php, golang etc . also i had worked with some program projects that i had build so far i know the concept how to programming properly , use library whether internal or external both of it Anyway thanks for giving me with kind of that recommendation i really appreciate that🙏🏻
adnanhossainme
Brothers, how do you guyz convert c/c++ to asm line by line understanding..
Ольга
Hello maybe someone can say How to combine two structure fields into an array? I will be grateful
Ольга
C or C++? You want to have array of structs?
On С. No array of structur. something similar to me has the structure of the first second and objects of this structure this interval [first, second) [first, second) and I need to bring an array of integers that are in these intervals
Артем
Hello maybe someone can say How to combine two structure fields into an array? I will be grateful
U can declare structure typedef struct { uint8_t first; uint_8t second; } my_struct; Then make an array. my_struct my_array[ARR_SIZE]
Артем
Or u can allocate size of the array dinamically, if needed
Anonymous
Hello guys. I've been looking for a book to learn c++. Does anyone have any recommendation
Pavel
On С. No array of structur. something similar to me has the structure of the first second and objects of this structure this interval [first, second) [first, second) and I need to bring an array of integers that are in these intervals
So you need an array of integers? That you can do with int someArrayName[SOME_ARR_SIZE]; and the interval you need to determine when you fill that array with actual data (e.g. if it's random, you need to generate the values in the interval, if the values are from the user input, you need to check the value that the user inputs, ...)
Anonymous
Can u provide any example, please?
#include<stdio.h> struct person{ char name[20]; }; void view_people(struct person* arr,int size){ for(int i=0;i<size;i++) printf("person[%d] name = %s\n",i,arr[i].name); } void main(){ struct person people[10]; for(int i=0;i<5;i++){ printf("Name:"); scanf("%s",people[i].name); } view_people(people,5); }
Артем
Oh, you mean just typedef part. For sure it is not a mandatory to use it. Totally agree with you However imho in big projects it is easier to use one simple name instead typing struct my_struct
Levi
I want Learn DSA . I am familiar with c . Should I learn c++ then DSA . Or c++ with DSA
Captain
I want Learn DSA . I am familiar with c . Should I learn c++ then DSA . Or c++ with DSA
If you learn some basics like how c++ differs from c and basic of STL that would suffice. Best luck 👍
Amaregouda
in which situations static variables can use??
Anonymous
in which situations static variables can use??
For example when u have created a player objects from player class a static variable can keep track of how many objects are currently active
Max
Can i sent screenshot of code here?
Max
Can i sent screenshot of code here?
to make more understandable code?
Ludovic 'Archivist'
to make more understandable code?
It is better if you put your code on a sharing website like pastebin.com or godbolt.org
the best for everyone
#include <stdio.h> typedef struct { int roll ; char name[20]; double gp; }Student ; void inputStudent(Student *studentPointer){ printf("Enter a number of a roll"); scanf("%d ",&studentPointer->roll); printf("Enter a name of the student"); scanf("%[^/n]",studentPointer->name); printf("Enter a grade of the student"); scanf("%lf",studentPointer->gp); } void printStudent(Student student){ printf("roll = %d , name = %-20s , grade = %10,2lf \n",student.roll,student.name,student.gp); } int main(){ Student s ; inputStudent(&s); printStudent(s); return 0; }
the best for everyone
anyone can tell me what is the mistake in this ?
Anonymous
&studentpointer->gp
the best for everyone
&studentpointer->gp
oh yes you are right thank you for reminding me
the best for everyone
&studentpointer->gp
but it still didn't work very well
Anonymous
but it still didn't work very well
scanf("%[^\n]s",studentpointer->name);
the best for everyone
scanf("%[^\n]s",studentpointer->name);
its not letting me add the grade of the student
Anonymous
Then use fgets(studentpointer->name,20,stdin);
Max
Can someone explain what happening here in return line, "reinterpret_cast", "uintptr_t", "GetModuleHandle" , "offsets->u_world" - I mean this item used to import. Code example in this link.
the best for everyone
Anonymous
Hello
Anonymous
ImGui::Image((PVOID)photo, ImVec2(140, 170)); How to use this code please help me
the best for everyone
Remove this
I made it and I still have the same problem