Dev C++ Exit Function

Jun 26, 2008  Dev C First Program in Urdu 1st Program Start Coding - Duration: 8:56. Pak Academy79 20,312 views.

Hi,

I'm still a beginner for C programming. In my assignment I've encountered this problem and I know is a linker problem but I'm not sure how to solve it. I'm trying to link 3 files which 2 .c files and 1 .h file. Below are the codes for my file:

These 3 files are my codings. I hope someone can help me out. I'm stuck at his problem for long time. Thanks in advance. Appreciate your help.

Dev c++ exit function video
  • 5 Contributors
  • forum 4 Replies
  • 11,442 Views
  • 5 Years Discussion Span
  • commentLatest Postby Sean1234$Latest Post

Banfa597

I think you mean Ld returned 1 exit status.

Do you really mean you tried to link the 2 c files and the h file or do you mean you compiled the c files and tried to link the resulting objects?

The processor of building a program is

  • Compile each individual source (.c) file producing an object file (.o or .obj)
  • Link all the object files produced in stage 1 with any require libraries

C++ Exit Function

NOTE 1: you neither compile or link header (.h) files, they are included into source (.c) files and the code the contain is compiled in that manner.

NOTE 2: It is very poor practice to #include source files (.c) into other source files (.c) as you have done in your driver.c listing. However if you must/do do that then you should not separately compile the source (.c) that you included.

Normally the IDE handles the build process for you so it would help us to know what tools, compiler tool-chain and/or IDE you are using.

  • Related Questions & Answers
  • Selected Reading
CC++Server Side Programming

exit()

The function exit() is used to terminate the calling function immediately without executing further processes. As exit() function calls, it terminates processes. It is declared in “stdlib.h” header file. It does not return anything.

Here is the syntax of exit() in C language,

Here,

status_value − The value which is returned to parent process.

Here is an example of exit() in C language,

Example

Output

In the above program, a variable ‘x’ is initialized with a value. The value of variable is printed and exit() function is called. As exit() is called, it exits the execution immediately and it does not print the printf(). The calling of exit() is as follows −

abort()

The function abort() terminates the execution abnormally. It is suggested to not to use this function for termination. It is declared in “stdlib.h” header file.

Here is the syntax of abort() in C language,

Here is an example of abort() in C language,

Example

Exit

Here is the output,

Output

In the above program, a variable ‘a’ is initialized with the value and printed. As the abort() is called, it terminates the execution immediately but abnormally. The calling of abort() is as follows.

assert()

The function assert() is declared in “assert.h” header file. It evaluates the expressions given as argument. If expression is true, it does nothing. If expression is false, it abort the execution.

Here is the syntax of assert() in C language,

Dev c exit function calculator

Here.

Exit Function Cpp

exp − The expression you want to evaluate.

Here is an example of assert() in C language,

Example

C++ Break

Output

C++ Exit Function

In the above program, a variable ‘a’ is initialized with a value. The value of variable is printed and assert() function is called. As assert() is called, it evaluates the expression that ‘a’ is not equal to 15 which is false that is why it aborts the execution and shows an error.