0

why this function returns n ?

I have this example : #include <stdio.h> #include <cs50.h> int get_positive_int (void); int main (void) { get_positive_int(); } int get_positive_int ( void) { int n; do { n=get_int("insert positive:"); } while (n<1); return n; } I still don#t get why this function gives out n ? when the programm is running it doesn't give out integer

24th May 2020, 10:53 AM
Sumer Fattoum
Sumer Fattoum - avatar
2 Answers
0
Have you declared the get_int function? I can see no user input function here...
24th May 2020, 12:44 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
0
yes it is declared in cs50 library.. yes as the example says it doesn't get input..it only gives Output...but why ? since the user should enter an int.
24th May 2020, 1:16 PM
Sumer Fattoum
Sumer Fattoum - avatar