• Skip to main content
  • Skip to footer

CS50's Introduction to Computer Science on Edx: Supplementary resource

CS50 threads to aide as a supplementary resource

Seeking an explanation how function argument works

CS50 threads to aide as a supplementary resource › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 2 › Seeking an explanation how function argument works

Tagged: scrabble lab problem

  • This topic is empty.
Log In Register Lost Password
Viewing 1 post (of 1 total)
  • Author
    Posts
  • September 20, 2022 at 9:46 am #599
    admin
    Keymaster


      Copy Code
      Copied
      Use a different Browser

      
      
      int compute_score(string word);
      string find_winner(int score1, int score2);

       

      With compute_score, there will be two words used, word1 and word2. Instead of


      Copy Code
      Copied
      Use a different Browser

      
      
      int compute_score(string word1,string word2);

      It is


      Copy Code
      Copied
      Use a different Browser

      
      
      int compute_score(string word);
      

      This is unlike score1, score2 with find_winner. Is it due to get_string function to be used for getting input?

      What is confusing is that while word argument with compute_score will subsequently change to word1 and word2, the arguments with find_winner (score1, and score2) are mentioned exactly the way they will be later used.


      Reply


      https://edstem.org/us/courses/176/discussion/1791039?answer=4108983[learn_press_profile]

    • Author
      Posts
    Log In Register Lost Password
    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Log In

    Log in / Register

    Initiative by Digital Splendid OPC Pvt. Ltd.