Sponsored Content
Top Forums Programming When to define functions in C? Post 302895272 by alister on Sunday 30th of March 2014 08:49:10 PM
Old 03-30-2014
If you're re-using a library's function, you wouldn't have its definition (code) in your file at all. It's not uncommon to not even have access to a function's code, only the prototype in a header, the compiled binary, and (hopefully) some documentation.

Regards,
Alister

---------- Post updated at 08:49 PM ---------- Previous update was at 08:46 PM ----------

Quote:
Originally Posted by Lost in Cyberia
I mean can't you declare AND define it in one block of code before your main function?
You can. However, for larger projects, that type of organization quickly becomes an impediment.

Regards,
Alister
 

8 More Discussions You Might Find Interesting

1. Programming

mysterious #define

in the header file orville.h, outside of the #ifdef #endif , there is the following #define JOB_CONTROL /* support job-control */ As you can see, the JOB_CONTROL macro has no value associated with it. Here is what I go when I ran grep on the entire source code. $ grep -iR... (6 Replies)
Discussion started by: frequency8
6 Replies

2. UNIX for Dummies Questions & Answers

#define in perl

Hi friends, I am not sure if perl questions can be raised here. :rolleyes: But I have a doubt if there is a way to do "#define" in perl, like in C. Does anyone know if it is feasible (without CPAN modules)? Thanks, Srini (7 Replies)
Discussion started by: srinivasan_85
7 Replies

3. Programming

#define

Hello, I would like to conditionaly comment in my code source some fields from arrays. So I use the property ## from the #define definition. my code: ... #define slet /##* #define etsl *##/ ... const T_SVT_ADLL_A653_DESC A_DESC = { { slet qwerty etsl SLICING,... (3 Replies)
Discussion started by: cypleen
3 Replies

4. Programming

help with #define in C

if i do this in C #define NUM 1234512345 then how come i cant print it out using int main(int argc, char **argv) { printf("%d\n", NUM); return 0; } well the result is -1219236538, why isnt it 1234512345 ? (7 Replies)
Discussion started by: omega666
7 Replies

5. Programming

#define in c

Hi, I had a head file, looks like #define MIN_NUM 10 #define MAX_NUM 10 is there any way to get "MAX_NUM" from 10? thanks. peter (9 Replies)
Discussion started by: laopi
9 Replies

6. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

7. Shell Programming and Scripting

Define variable from file.

HI I have file A.txt _1A _2A _3A _4A I want define all as different variable. $1A=_1A $2B=_2A $3C=_3A $4D=_4A Now i can use any variable in my script. (3 Replies)
Discussion started by: pareshkp
3 Replies

8. Shell Programming and Scripting

Define Variables

Hi, I just define the variable in script and use those script in another script but the variable not recognize. test1.sh #!/bin/bash DB="test_db" USR="test_user" PWD="test_pwd" HST="24.254.87.12" test2.sh #!/bin/bash ./test1.sh mysql -u $USR -p $PWD -h $HST... (2 Replies)
Discussion started by: fspalero
2 Replies
brlapi_keycodes.h(3)						      BrlAPI						      brlapi_keycodes.h(3)

NAME
brlapi_keycodes.h - SYNOPSIS
#include 'brlapi_constants.h' Macros #define BRLAPI_PRIxKEYCODE PRIx64 #define BRLAPI_PRIuKEYCODE PRIu64 #define BRLAPI_KEY_MAX UINT64_C(0XFFFFFFFFFFFFFFFF) #define BRLAPI_KEY_FLAGS_MASK UINT64_C(0XFFFFFFFF00000000) #define BRLAPI_KEY_FLAGS_SHIFT 32 #define BRLAPI_KEY_FLG(v) ((brlapi_keyCode_t)(v) << BRLAPI_KEY_FLAGS_SHIFT) #define BRLAPI_KEY_FLG_MOD1 BRLAPI_KEY_FLG(0x00000008) #define BRLAPI_KEY_FLG_MOD2 BRLAPI_KEY_FLG(0x00000010) #define BRLAPI_KEY_FLG_MOD3 BRLAPI_KEY_FLG(0x00000020) #define BRLAPI_KEY_FLG_MOD4 BRLAPI_KEY_FLG(0x00000040) #define BRLAPI_KEY_FLG_MOD5 BRLAPI_KEY_FLG(0x00000080) #define BRLAPI_KEY_TYPE_MASK UINT64_C(0X00000000E0000000) #define BRLAPI_KEY_TYPE_SHIFT 29 #define BRLAPI_KEY_TYPE_CMD UINT64_C(0X0000000020000000) #define BRLAPI_KEY_TYPE_SYM UINT64_C(0X0000000000000000) #define BRLAPI_KEY_CODE_MASK UINT64_C(0X000000001FFFFFFF) #define BRLAPI_KEY_CODE_SHIFT 0 #define BRLAPI_KEY_CMD_BLK_MASK UINT64_C(0X1FFF0000) #define BRLAPI_KEY_CMD_BLK_SHIFT 16 #define BRLAPI_KEY_CMD_ARG_MASK UINT64_C(0X0000FFFF) #define BRLAPI_KEY_CMD_ARG_SHIFT 0 #define BRLAPI_KEY_CMD(v) ((v) << BRLAPI_KEY_CMD_BLK_SHIFT) #define BRLAPI_KEY_SYM_BACKSPACE UINT64_C(0X0000FF08) #define BRLAPI_KEY_SYM_TAB UINT64_C(0X0000FF09) #define BRLAPI_KEY_SYM_LINEFEED UINT64_C(0X0000FF0D) #define BRLAPI_KEY_SYM_ESCAPE UINT64_C(0X0000FF1B) #define BRLAPI_KEY_SYM_HOME UINT64_C(0X0000FF50) #define BRLAPI_KEY_SYM_LEFT UINT64_C(0X0000FF51) #define BRLAPI_KEY_SYM_UP UINT64_C(0X0000FF52) #define BRLAPI_KEY_SYM_RIGHT UINT64_C(0X0000FF53) #define BRLAPI_KEY_SYM_DOWN UINT64_C(0X0000FF54) #define BRLAPI_KEY_SYM_PAGE_UP UINT64_C(0X0000FF55) #define BRLAPI_KEY_SYM_PAGE_DOWN UINT64_C(0X0000FF56) #define BRLAPI_KEY_SYM_END UINT64_C(0X0000FF57) #define BRLAPI_KEY_SYM_INSERT UINT64_C(0X0000FF63) #define BRLAPI_KEY_SYM_FUNCTION UINT64_C(0X0000FFBE) #define BRLAPI_KEY_SYM_DELETE UINT64_C(0X0000FFFF) #define BRLAPI_KEY_SYM_UNICODE UINT64_C(0X01000000) Typedefs typedef uint64_t brlapi_keyCode_t Author Generated automatically by Doxygen for BrlAPI from the source code. Version 1.0 Mon Apr 1 2013 brlapi_keycodes.h(3)
All times are GMT -4. The time now is 01:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy