• This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #61
    admin
    Keymaster

      Reproducing part of Lecture 1 below:

      “We can even change our meow function to take in some input, n, and meow n times:

      
      
      #include <stdio.h>
      
      void meow(int n);
      
      int main(void)
      {
          meow(3);
      }
      
      void meow(int n)
      {
          for (int i = 0; i < n; i++)
          {
              printf("meow\n");
          }
      }

      The void before the meow function means that it doesn’t return a value, and likewise in main we can’t do anything with the result of meow, so we just call it.”

      To me, it returns a value, which is “meow\n”. Once meow function called, it is generating an output, which to me returning a value. I know I am perhaps unable to differentiate between calling without value and calling with value. Help appreciated.


      Reply


      https://edstem.org/us/courses/176/discussion/900183?comment=2052583[learn_press_profile]

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Scroll to Top