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
Anonymous
This one a part of example in textbook talking about write a program print menu
Pavel
Pavel
Anonymous
Menu
Anonymous
Void can more than one main cant ?
Anonymous
Void main(){} - - one program only have one..?
Void xxx(xxx)- - can more than one in a program?
Anonymous
Wow….you so intelligent 🥹🥹🥹 i almost give in IT for university year 1 sem1😿thanks for ur helping
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….
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)
klimi
Anonymous
All haven’t learn
conko
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
Pavel
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
Pavel
#cppbookguide
Pavel
doesn't work anymore?
klimi
Anonymous
Anonymous
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
Pavel
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.
mito
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
anubhav
hi
Swara
?
anubhav
?
you havn'tused strcomp
Gilded
??
anubhav
Anonymous
Anonymous
Yes
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 = &real; //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 = &real;
| ^
BUT, this time:
ran by:
➜ Devel ./a.out
hello from f() called in an awkward way
Anonymous
《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
Kevin
《K•r•e•m•e•l》
Let me paste the question...