Alviro Iskandar
レッギ
variadic arguments?
Ah, yes. I forgot it
\Device\NUL
why yes
I never learn Windows API, so i don't know why
レッギ
And make compare HIWORD(lParam) with ascii code from english keyboard
Anonymous
how to get statement
Artur
anyone here has an experience crosscompiling c++ code for microcontrollers using docker ?
レッギ
how to get statement
Use switch case. For example case WM_KEYDOWN: case WM_SYSKEYDOWN: Switch(wParam) { case "your ascii code here": [Do somethinf] break; }
Anonymous
can anyone please explain what is the below code doing
Anonymous
// Return the number of digits in d int getSize(long d) { string num = to_string(d); return num.length(); } // Return the first k number of digits from // number. If the number of digits in number // is less than k, return number. long getPrefix(long number, int k) { if (getSize(number) > k) { string num = to_string(number); return stol(num.substr(0, k)); } return number; }
Shubhuu
Hey guys can anybody let me know how I can start the C++ language from basics and Excel it with time to a competitive level ?
Your senpai : )
hey
Shubhuu
hey
Yes can you help me?
Pavel
Hey guys can anybody let me know how I can start the C++ language from basics and Excel it with time to a competitive level ?
Read books or read/watch tutorials; practice what you read; if you don't understand something, google it; if you can't find an answer in google, ask other devs (e.g. in this chat); do your own projects; collaborate with other developers (e.g. helping with their open-source projects).
Your senpai : )
Yes can you help me?
yeah sure if i can
Your senpai : )
Here any experienced c++ programmer i want to ask something.
Prince Of Persia
Here any experienced c++ programmer i want to ask something.
I'm sure if you ask your question it would be answered
Your senpai : )
I'm sure if you ask your question it would be answered
I'm BCA student from past few months I'm learning c++ but I'm just learning how to code and DSA but i can't create a single program with GUI
Tushar
You need to read books for this as no YouTube video will go in so much detail
Tushar
tbh I don't know the book which you need
Tushar
But you can search in google
Tushar
I am sure you will get something to help you out
Your senpai : )
I am sure you will get something to help you out
Actually everyone say to create some projects or contribute in community but how can i do this i dont have any guide
Your senpai : )
Your senpai : )
Is it important to learn GUI for give my contribution in community?
I'm learning programming from home. I don't have any friends and college teachers because I'm doing my degree from open University
Your senpai : )
🥲
Pavel
Actually everyone say to create some projects or contribute in community but how can i do this i dont have any guide
Well, first you need to decide what you want to build, for example I started from building a simple 2D game (well, in the end it turned out that it's not that simple and after 8 years it's still not completed, but I learned a lot). There are other rabbit holes like writing OSes, browsers, or scripting languages, which is fun, educating and something that you can mention during an interview, but likely not something that will be ever finished in production quality. But it doesn't need to be big (just when you don't have experience it's easy to underestimate time to develop something), but it has to be something that is fun to you. About contributing, a lot of programmers who work on open source project need contribution. It is likely some boring parts (at least for them), but for you it can be a interesting experience. Some of your friends may be working on something, or you can ask around if someone needs extra hands on their project. E.g. I need a person who want to learn Opengl to rewrite a render layer of my engine (yes, that one that I mentioned above :))
Tushar
participate in hackathons
Tushar
you learn more
Tushar
mlh.io is a good site for it
klimi
Are you advertising a discord server where people can hire people to solve their homeworks?
klimi
Please answer my question
Your senpai : )
Is DSA concepts same in mostly languages?
klimi
why do you need to read rules for clarifying your message? I am confused
Ludovic 'Archivist'
Advertising is a no-no. Else I would be doing it everyday xD
Tushar
Sorry for the late reply
Tushar
I got to know about it from my sister, though I haven't taken part in any uptil now, people from all around the participate in it, so it's a good link that I am sending to you
Tushar
Not advertising anything
Tushar
By clicking on the message that klimi sent on why are you adversiting a discord server..... It's pointing to my message about the mlh.io site, that's why sent the above messages to clarifiy
%Nikita
Pavel
Is it necessary to contribute open-source to become a great developer?
Not really, but you need to learn how to collaborate with people (at least how to use source control while working together, at max learn social/soft skills). You can of course learn that after you get a job.
%Nikita
I'm learning programming from home. I don't have any friends and college teachers because I'm doing my degree from open University
Oh. The same. But not exactly the same. I have friends, but none of them in my age are interested in programming or cs. Only friends of my parents are in theme :)
%Nikita
Not really, but you need to learn how to collaborate with people (at least how to use source control while working together, at max learn social/soft skills). You can of course learn that after you get a job.
Thanks for reply! And if I already know git for example, will it help me to contribute with other people, or I have to learn more to contribute one project with git? Not local - with other people together.
%Nikita
Basically array access is syntax sugar for pointer. arr[i] same as *(arr + i)
For the first time I thought that *(arr + i) working only with those arrays, which elements have size equal to 1 byte. Because sizeof gets size in bytes. Malloc takes size in bytes. Why +i is not add i bytes - it means add i elements.
%Nikita
Basically array access is syntax sugar for pointer. arr[i] same as *(arr + i)
And that’s why we can do this: p[-1]; //takes element, which goes before p 1[p]; //equal to p[1];
coal
Exactly! What about strtok() to select individual words? Is it good idea?
only if you're not gonna use it in a multithreaded application. strtok is not thread-safe as it uses a static buffer for parsing
\Device\NUL
For the first time I thought that *(arr + i) working only with those arrays, which elements have size equal to 1 byte. Because sizeof gets size in bytes. Malloc takes size in bytes. Why +i is not add i bytes - it means add i elements.
Yes, it depends on its type, for example int32_t *ptr = (arr + 1) is different with int8_t *ptr = (arr + 1) int32_t *ptr = (arr + 1) is same as int8_t *ptr = (arr + 4) because int32_t is 4 byte and int8_t is 1 byte You could try casting too #include <stdio.h> #include <stdint.h> int main(void) { puts((char *){8583909746840200520, 143418749551}); return 0; }
Alviro Iskandar
Yes, it depends on its type, for example int32_t *ptr = (arr + 1) is different with int8_t *ptr = (arr + 1) int32_t *ptr = (arr + 1) is same as int8_t *ptr = (arr + 4) because int32_t is 4 byte and int8_t is 1 byte You could try casting too #include <stdio.h> #include <stdint.h> int main(void) { puts((char *){8583909746840200520, 143418749551}); return 0; }
This could be misleading, the pointer arithmetic result is not relevant with the assignment here. int32_t *ptr = (arr + 1); is not the same with int8_t *ptr = (arr + 4); The arithmetic result depends on what type arr is. Not what type ptr is! This code: #include <stdint.h> #include <stdio.h> int main(void) { void *arr = (void *)0x1ul; int32_t *ptr1 = (arr + 1); int8_t *ptr2 = (arr + 4); printf("%p %p\n", (void *)ptr1, (void *)ptr2); return 0; } has output 0x2 0x5, valid on GNU env, they assume void has size 1 only when playing with pointer arithmetic.
Alviro Iskandar
I understand your intention, the pointer arithmetic size depends on the type, for example like this: #include <stdint.h> #include <stdio.h> int main(void) { void *arr = (void *)0x1ul; int32_t *ptr1 = arr; int8_t *ptr2 = arr; printf("%p %p\n", (void *)(ptr1 + 1), (void *)(ptr2 + 4)); return 0; } Both ptr1 and ptr2 are pointing to address 0x1. The output of that printf is 0x5 0x5 because the syntax ptr1 + 1 adds the pointer value by 4 and ptr2 + 4 adds the pointer value by 4 too. The reason is that sizeof(int32_t) is 4 and sizeof(int8_t) is 1.
Adib
#ask Hello people, i have question about regex, probably anyone know the answer? https://www.quora.com/unanswered/Why-is-all-in-regex-symbolized-as-char-Why-not-using-other-character
-
Hello guys. Could you give me an idea ? I need remove all 5 from an integer, leaving an order of digits the same
-
For example, 461525 should be 4612
-
I did using while loop , but in this case an order is not the same. Like 461525 was 2164
-
#include <stdio.h> int main(){ int num,digit,newnum=0; printf("Enter a number: "); scanf("%d",&num); while (num>0){ digit=num%10; if (digit!=5){ newnum=newnum*10 + digit; num=num/10; } printf("%d\n",newnum); return 0; }
Tushar
cause the num is now to be reversed right so then do another while loop on it
Tushar
you got it right?
-
Yes I will try now
Tushar
okk
-
but how to do it in only 1 loop? I want to do it only in 1 loop cause with 2 loops it will be a long code
Tushar
with one loop you can create a count variable containing the total number of digits that are there in the input, and you can decrease the count after every iteration ( think of a loop within a loop and some condn that you need to figure out) whenever it gets the matching number so in the while loop just create a if condn (besides the loop within a loop )that when the count becomes zero and another variable is to be created too which is 0 and it increments with the number of Matching numbers that are there. So create a if cond with both of these AND operation will be used
Tushar
This is way that I was able to put it across to yo
Tushar
Sorry if it doesnt make sense, typing in a hurry
-
I got confused
-
But thank you for your attention
Anonymous
Photo are not allowed to post??
Anonymous
I want to post a ques
-
@kickstart22 thank you very much. I did it with 2 loops. It works as I want. And code is not long