- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Software programming learning aide
CS50 threads to aide as a supplementary resource › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 2 › Printf and return functions synonymous?
Tagged: c, data type, printf, return, return value, returning values, scrabble lab problem, value returned by function
string find_winner(int score1, int score2)
{
if (score1 > score2)
{
return "Player 1 wins!";
}
else if (score2 > score1)
{
return "Player 2 wins!";
}
else
{
return "Tie!";
}
Using printf:
if (score1 > score2)
{
printf ("player1 winner");
}
if (score2 > score1)
{
printf ("player2 winner");
}
else
{
printf ("tie");
}
Are return and printf functions synonymous?
Reply
https://edstem.org/us/courses/176/discussion/933883?answer=2123080[learn_press_profile]