User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:control_structures:return
click
to support this page (eg 0,42 € or so) Thanks.

return

   #include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
   return value;

returns a value

C Sourcecode Example

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <stdlib.h>
#include <string.h>
 
int yesno( char value1[], char value2[] ){
 
    if ( strcmp( value1, value2 ) == 0)
	{
	    return 0;
	} else {
	    return 1;
	    }
}
 
int main(void) {
 
    char str1[]="ADS";
    char str2[]="FJK";
 
	if ( yesno( str1, str1 ) == 0 ) {
	    printf("same\n");
	    } else { printf("different\n"); }
 
	if ( yesno( str2, str2 ) == 1 ) {
	    printf("different\n");
	    } else { printf("same\n"); }
 
	if ( yesno( str1, str2 ) == 0 ) {
	    printf("same\n");
	   } else { printf("different\n"); }
 
return 0;
}
  output:
  
  same
  same
  different
advertising
c/control_structures/return.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum