Navigation

    ask avan logo
    • Register
    • Login
    • Search
    • Categories
    • Unsolved
    • Solved

    why this code is not giving o/p as 3?

    C
    2
    2
    18
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AshutoshxxTeotia
      AshutoshxxTeotia last edited by

      #include<stdio.h>
      void tried();
      int main(int a,int b)
      {
          int c=a+b;
          return c;
      }
      void tried()
      {
          printf("%d",main(1,2));
      }
      
      Reply Quote 0
        1 Reply Last reply

      • avan
        avan last edited by

        Hey @AshutoshxxTeotia

        How about something like this

        main();
        
        int main()
        {
            printf("%d",tried(1,2));
        }
        void tried(int a,int b)
        {
            int c=a+b;
            return c;
            
        }
        
        Reply Quote 0
          1 Reply Last reply

        • avan
          avan last edited by

          Hey @AshutoshxxTeotia

          How about something like this

          main();
          
          int main()
          {
              printf("%d",tried(1,2));
          }
          void tried(int a,int b)
          {
              int c=a+b;
              return c;
              
          }
          
          Reply Quote 0
            1 Reply Last reply

          • First post
            Last post