Solved

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

Posted on 1997-03-29
2
244 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 63
Expand macro to ask for filename column 8 37
notReplace  challenge 53 131
Not needed 13 113
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

832 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