Eturnus
What should be a function declaration If i am making a programm to divide 2 numbers using function
Eturnus
float div(int,int); Is it correct??
Eturnus
Please explain
Alex
Please explain
you can do integer division like 5/2 = 2. or float 5/2=2.5. Also you think about this one: 5/0. how are you going to inform about error?
Eturnus
Floating division
Alex
float div(int,int); Is it correct??
correct, if you want to return inf on zero division
Eturnus
For floating division should i write float div(float a,float b);
Alex
yes
Eturnus
This is first time i am making function programm so getting errors
Alex
For floating division should i write float div(float a,float b);
however it does not make a big sense. why to not use a/b? why do you need function at all?
Eturnus
I am learning how to use function thats why trying to make add,subt, multiply etc
Eturnus
#include<stdio.h> float div(float ,float ); int main() { float num1,num2,answer; printf("enter 1st number:"); scanf("%f",&num1); printf("enter 2nd number:"); scanf("%f",&num2); answer=div(float,float); printf("\n value= %f",answer); return 0; } float div(float x,float y) { float result; result=x/y; return result; }
Alex
float div(float x,float y) { float result; result=x/y; return result; } better: float div(float x,float y) { return x/y; }
Eturnus
Ok let me try
Alex
Ok let me try
but your option is not mistake. should work
Maide
Or you mean that you have no choice but to use it?
Actually i dont understand clearly my question so i asked
lbxbcx129
/Wpedantic
Chirag
/Wpedantic
Dima
/blue_text_must_click
Chirag
Which is the best book for Opp in C++
....
Can someone provide me link from where I can get whole knowledge of git and github about clone , fork and all other things
....
?
Anonymous
please is there any APP for windows which i can use for java
Dima
bruh
Anonymous
bruh
is that the name lol
Anonymous
Hello, can header files use recursive functions?
Pavel
Hello, can header files use recursive functions?
What do you mean by "use" in this context?
Anonymous
I created a header file that contains a recursion but when function from header is called, I get the error message, multiple definition of function
Satendra Kumar
/blue_text_must_click
Pavel
Anyone knows?
They have links on the official website. By the way, it's off topic here https://git-scm.com/doc
Pavel
I created a header file that contains a recursion but when function from header is called, I get the error message, multiple definition of function
That's not related to recursion, why don't you move it to cpp and leave only the declaration in the header?
Pavel
Ok
You can read about One Definition Rule (ODR) for the details about the error itself.
Jaaa
Int arr[100] ={0}
Jaaa
What does this mean
Pavel
What does this mean
If it's C++ then https://en.cppreference.com/w/c/language/array_initialization#Initialization_from_brace-enclosed_lists
Crow
Int arr[100] ={0}
An array of 100 integer elements called arr with the first element initialized with the value 0
Ameer El-Areer
hi all
Ameer El-Areer
who is good in c programming
Alex
Linus Torvalds, Ken Thompson, Brian Kernighan I guess
Ameer El-Areer
hahahahhaha
Pavel
It's not an error?
In C++ at least it's not, you can initialize only part of the elements, the rest will be default initialized (the link above)
Pavel
hahahahhaha
No PM please
Ameer El-Areer
why
Ameer El-Areer
need a good man in c
Pavel
need a good man in c
I don't do private consultations. If I did, I would charge a lot for that :p
Ameer El-Areer
hahhahhahah
Anonymous
?
Ameer El-Areer
?
good in c programmin
Ameer El-Areer
g]
Pavel
good in c programmin
Why don't you ask your questions here? Have you read the link I've sent you? People usually don't answer questions like this, even if they good at it (unless you provide a good reason why they should)
Pavel
@neko_code sorry for direct mentuon, Rose is still down UPD: ok, nevermind, the message was deleted
Igor🇺🇦
/report
Pavel
Rules violation, obviously
Crow
It's not an error?
It is not (except for the forgotten semicolon), it assign the 0 value to the first element of the array
Boris
Good time of the day to everyone! I am writing a program in C and having trouble with writing numbers that I loaded from one file to another file using mmap. I need to use mmap because I'm working with a really big file that takes a lot of time to run in program.
yue
😏
Jaaa
can a recursive function be void
olli
can a recursive function be void
yes, a function with return type void can be called recursively
Jaaa
🤨🤨
Jaaa
If i want to print fibbconi series
Jaaa
Can i use function type void 🤨🤨🤨
olli
Can i use function type void 🤨🤨🤨
If you want to print the fibonacci series you're better off not using recursion in the first place. But yes, you could use a void returning function to print the fibonacci series.
Jaaa
Media doesn't allow how i show ss of code
olli
Media doesn't allow how i show ss of code
you should have read the rules, they clearly state how to share code. you can use sites like https://godbolt.org/