Anonymous
Ok thanks everyone
Pavel
Ok thanks everyone
Note that main is a special function and has special treatment. E.g. you don't have to return from it, return 0; will be assumed. You also should never call it from your code.
Anonymous
Hmmmm….one program only van include one void main(){} isn’t?
Pavel
Hmmmm….one program only van include one void main(){} isn’t?
Well, it is true more or less for every function. You can have only one function with the same signature in the global namespace of your app. But yes, only one main, i think even if they have different signatures (same name but different arguments)
Anonymous
But why i refer textbook , have some code like void menu(void); { menu(); return 0; void menu(void) Printf(“”) …. }
Anonymous
Why many void QAQ
Pavel
But why i refer textbook , have some code like void menu(void); { menu(); return 0; void menu(void) Printf(“”) …. }
Do they have it in one listing? Maybe they mean them as different apps/different examples?
Anonymous
This one a part of example in textbook talking about write a program print menu
Pavel
But why i refer textbook , have some code like void menu(void); { menu(); return 0; void menu(void) Printf(“”) …. }
You can see both errors here: about void and about redefinition https://wandbox.org/permlink/D3IYmZLEQ0n6tmq8
Anonymous
Menu
Anonymous
Void can more than one main cant ?
Pavel
Void can more than one main cant ?
not sure if I understand this question are you sure you typed your example above correctly, without mistakes/typos?
Anonymous
Void main(){} - - one program only have one..? Void xxx(xxx)- - can more than one in a program?
Pavel
Void main(){} - - one program only have one..? Void xxx(xxx)- - can more than one in a program?
void is just a return type of a function, that designates that the function has no return value. functions that return void are not special compared to other functions. main function is special. you can't have two functions with exactly same name and same arguments in your program (unless they are in different namespaces, but you can ignore this part for now)
Anonymous
Wow….you so intelligent 🥹🥹🥹 i almost give in IT for university year 1 sem1😿thanks for ur helping
Pavel
Void main(){} - - one program only have one..? Void xxx(xxx)- - can more than one in a program?
you can have many different functions, you just make sure they have different names int main() {} void meny() {} void otherFuction() {} int sum(int a, int b) { return a + b; }
klimi
and this is why is good to teach assember before C, then you know what symbols are and what c functions are (just my opinion)
Anonymous
My practical now is only learn program that include void main only and process,then printf printf….
Pavel
and this is why is good to teach assember before C, then you know what symbols are and what c functions are (just my opinion)
not sure, I think it's better to teach something that you can see results faster with. Otherwise you will drop it thinking that all the programming is the same complex and all the other people who write big applications are just magicians.
Anonymous
I dont know when i need to use like just now what i ask (voidxxx(xxx))
Anonymous
And i also dont know when i need to use int(xxx)
Anonymous
All haven’t learn
conko
void main is non-standard, I think only MSVC supports it, so it preferable only use int main if you want your app to be portable.
True for C++, however in C a void main can satisfy the requirements of implementation-defined versions.
Anonymous
When i need to use void xxx(xxx) ,when i need to use int main(void), int xxx(void),…all teacher haven’t teach but assignments so hard🥹🥹🥹🥹
conko
and mix them again in the future XD
Anonymous
What?!
conko
no
conko
a implementation-defined version need to present in the documentation of the implementation
conko
it's optional
conko
In C++ the standard requires that even impl-def versions of main should return only int
Anonymous
Hmm…i have questions from assignments, user input a will jump to page A , user input b will jump to page B, user input c will jump to page C , how can i code this?
conko
so a void main in C++ just violates the standard
Pavel
When i need to use void xxx(xxx) ,when i need to use int main(void), int xxx(void),…all teacher haven’t teach but assignments so hard🥹🥹🥹🥹
Find some beginner tutorials online (e.g. on youtube) or some other book, we have lists of books here somewhere
Pavel
#cppbookguide
Pavel
doesn't work anymore?
Anonymous
doesn't work anymore?
I tape it no function
Pavel
ohno, book notes are gone
Anonymous
Ohno🥹
Pavel
Ohno🥹
well, ok, then you need to google the tutorials for beginners I guess :)
Anonymous
Now my textbook already learn till chapter 6 call making decisions
Anonymous
Oh my goodness so complicated
klimi
ohno, book notes are gone
https://t.me/cpp20programming/184
Anonymous
Thank u so muchhh
Anonymous
guys can you help me to understand what a void pointer is and when it can be useful?
conko
Any pointer can be implicitly converted to void* and explicitly converted from it. It can be used for type erasure.
conko
for example memset accept pointers of any type be assigning its parameter type as void*
conko
though it's not a complete parameter polymorphism, it does work for that situation.
Anonymous
So, the offset to &codecave is calculated from hook_location + 5 instead of just hook_location . Because I assume the instruction is 5 bytes and spans from 0x0040AD9D to 0x0040ADA1
The offset is from the next instruction to be executed. The current instruction is at 0x0040AD90. You know that the next instruction begins at 0x0040ADA1. So you account for that l guess. I can't comment much unless I see the full code rather than snippets.
Anonymous
Hi, does anyone have experience in reverse engineering I want to learn C/C++ for that matter to prepare
Anonymous
someone who wants to team for malware analysis in ghidra? i do not have much experience but i want to learn at all costs
İbn
#include<iostream.h> int main() {int a,b,i; scanf("%d",&a); printf("the number it abele to dive. is\n"); for(i=1;i<= a;i++) if( a % i==0) printf("%d\n", i);}
İbn
Can you guys modify this code, I want the function to recursion it self ?
İbn
Recursion
urs
How to get udemy courses for free
Gilded
Pls don't mind if it's off topic just 1 msg i really want a techy people grp to share tech things news etc eachother help eachother friendly grp pls if have send me😢🙏
Gilded
How to get udemy courses for free
I can any course right in the account
anubhav
hi
Swara
?
anubhav
?
you havn'tused strcomp
Iwan
#include<iostream.h> int main() {int a,b,i; scanf("%d",&a); printf("the number it abele to dive. is\n"); for(i=1;i<= a;i++) if( a % i==0) printf("%d\n", i);}
int a; void rekme(int i) { if (a%i==0){printf("%d\n",i);} if (i==a){goto finish;} rekme(i+1); finish:; } int main() { scanf("%d",&a); printf("the number it abele to dive.> rekme(1); }
Gilded
??
anubhav
??
what
Anonymous
what do this code mean ptrStore = (_DWORD *)(*(int (**)(void))(*(_DWORD *)*ptrStore + 92))();
A function call that returns a pointer to a _DWORD (typedef int _DWORD for x86)
Anonymous
Yes
Anonymous
the int (**)(void)
trying to understand that, even GCC seems confused
Anonymous
why sending media is not allowed, lol
Anonymous
trying to understand that, even GCC seems confused
#include <stdio.h> void f() { puts("hello from f() called in an awkward way"); } typedef void (**fnptr)(); int main() { void* real = &f; fnptr rt = real; (*(fnptr)rt)(); } this piece of code, compiled using this cmdline: gcc -O0 test.c ran by: ➜ Devel ./a.out [1] 46629 segmentation fault (core dumped) ./a.out but then, just by adding the address-of operator: #include <stdio.h> void f() { puts("hello from f() called in an awkward way"); } typedef void (**fnptr)(); int main() { void* real = &f; fnptr rt = ℜ //added here (*(fnptr)rt)(); } INSTEAD, this piece of code, compiled using this cmdline: gcc -O0 test.c test.c: In function ‘main’: test.c:11:16: warning: initialization of ‘fnptr’ {aka ‘void ()()’} from incompatible pointer type ‘void **’ [-Wincompatible-pointer-types] 11 | fnptr rt = ℜ | ^ BUT, this time: ran by: ➜ Devel ./a.out hello from f() called in an awkward way
《K•r•e•m•e•l》
Hello guys...I've got an issue is there anyone who can help me out with creating a printf function
《K•r•e•m•e•l》
Let me paste the question...