FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    C language program routine file structure

     

    In the past, writing C language programs are written in a file, hundreds of lines, can you have time to practice the algorithm, now engage in modular programming, so-called modular programming, means a program contains multiple source files ( .c files and .h files), each .c file can be referred to as a module. 1, the file structure of routines 2, each file code main.c source code: #include #include "incrude / func.h" INTMAIN () { INTN1 = 1, N2 = 10; Printf ("from% D to% D and% LD \ N", N1, N2, SUM (N1, N2)); Printf ("From% D by% D% LD \ N", N1, N2, MULT (N1, N2)); Printf ("OS:% S \ N", OS); Printf ("Power By% S (% s)", getWebName (), getWeburl ()); Return0; } Math.c source code: / / No function declaration or macro in func.h, or it is not included. #include "../include/func.h" / / Add to EndNumlongsum from fromnum (intFromnum, intendnum) { Inti; LongResult = 0; // Parameter does not meet the rules, return -1 IF (fromnum<0 || Endnum<0 || Endnum { Return-1; } For (i = fromnum; i< = endnum; i ++) { Result + = i; } // Return to equal to 0 value ReturnResult; } / / Take the endnumlongmult (intfromnum, intendnum) from fromnum { Inti; LongResult = 1; // Parameter does not meet the rules, return -1 IF (fromnum<0 || Endnum<0 || Endnum { Return-1; } For (i = fromnum; i< = endnum; i ++) { Result * = i; } // Return to equal to 0 value ReturnResult; } Web.c source code: // Use the macro definition in func.h, must contain it, otherwise compile errors #include "../include/func.h"char* getWebName () { ReturnWeb_name; } char * getWeburl () { ReturnWeb_url; } Func.h source code: #ifndef _func_h #define _func_h // use macro definition instead of global variables #define os "linux" #define web_url "http://www.baidu.com" #define web_name "Baidu" // can also omit extern, but for program readability, it is recommended to write EXTERNLONGSUM (INT, INT); Externlongmult (int, int); EXTERNCHAR * GETWEBNAME (); EXTERNCHAR * GETWEBURL (); #ENDIF operation result: From 1 to 10 and 55 from 1 to 10 to 10 in 3628800os: Linux, read full text, original title: Pulk easy to understand! Linux C modular programming instance explanation Article Source: [Micro Signal: GH_C472C2199C88, WeChat public number: embedded ARM] Welcome to add attention! Please indicate the source of the article.

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us