Solved

Can I make my own Function and how would I define it to do what I want

Posted on 1997-03-29
2
223 Views
Last Modified: 2013-12-26
Well. I just got started with using the language C on my new macintosh and I had some qestions. I was wondering, I read a few books and I saw that it had functiopn like randomize() main() ect... Now, my question is, can I make my own function like malaka() and say I want it to count. Is that possible? And if so, how would I define it. Would it look like

malaka()
{
printf("count from 0 to 10")
return 0;
}

or something. Also, I am very curious with this question. I have noticed that when I open a program, take microsoft excel for example, I notice someting that comes up before I use the program that has the excel logo, copyright, ect.... How can I do that using C? Thanks alot for your time

Send all answers to noula6@tiac.net
0
Comment
Question by:malaka
2 Comments
 

Accepted Solution

by:
carrieb earned 50 total points
Comment Utility
Hi,
      You sure can make your own function ( that's what programming is all about ).
      your exemple put "count from 0 to 10" on the screen
      it doesn't do the count, if you want to count, it would
      look like that

      malaka()
      { Int I;
          for( I = 0; i <=10 ; i++ )
             Printf("%d\n", i );
          return 0;
        }

      for you second question...
      you don't really need to know C ( you can use other                    langage ) for
      that  , you need more the I Inside Macintosh.
      
      I don't know how familiar you are with the mac
      programming, but if you want to do it,
      you will surely need some of the inside mac.
      ( depending of what you want to do )

      here is how we do it :
      
      first : you make a pict of what you want to
              show ( you could do it on the fly, but
            it would be complicated for nothing )
            
      second : you use the resource.
                 you can use ResEdit or some other.
              you can also make it by hand, but
                 you will need Inside Mac for that.
                 you will make a dialog with the pict
                 you want in it.      
      
      third  : in your programme,
                 you will call the resource and put
                it on the screen...


      there is other way to do this, but i think
      this is the easiest...

      if you want to do this, you will need the inside mac.

      hope this help...


Benoit Carrier
 
0
 

Expert Comment

by:Kheldar
Comment Utility
Hi,

when you want to make a function of your own, you have to make a function prototype first, like this,



void malaka( void );



Write that line before your main function.

When you want to call it from main, write like this:



malaka();



Outside main(), the function should be written just like carrieb writes, except the first line. It should be like this:



void malaka( void )



I think that would work better.



Adam Axelsson
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now