Solved

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

Posted on 1997-03-29
2
233 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
ID: 1291428
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
ID: 1291429
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 79
sumDigits challenge 9 123
ShiftLeft challenge 21 76
building a service to accessed via telnet client, want colors ? 4 82
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

910 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

16 Experts available now in Live!

Get 1:1 Help Now